Skip to content

ci: upload the coverage badge only on pushes to master - #151

Merged
allen0099 merged 1 commit into
masterfrom
ci/coverage-badge-push-only
Sep 25, 2026
Merged

allen0099 merged 1 commit into
masterfrom
ci/coverage-badge-push-only

Conversation

@allen0099

Copy link
Copy Markdown
Owner

What

The Coverage Badge workflow runs on both push to master and pull_request. Until now its last step, "Upload coverage badge", pushed coverage.svg to the coverage-badge branch on every run. That causes two problems:

  • A pull request from a branch in this repository overwrote master's badge with the pull request's coverage.
  • A pull request from a fork gets a read-only GITHUB_TOKEN, so the push failed with 403 and turned the coverage check red. On feat: add CacheLock and the expire_if_equals backend primitive #150 this happened even though all 780 tests passed with live Redis and Memcached and coverage was 100%.

The upload step now runs only when github.event_name == 'push'. Pull requests still run the suite against the live servers and still enforce the coverage gate. They just no longer publish the badge.

Verified

  • actionlint reports nothing new. Its one note, SC2102 on the genbadge[coverage] line, is also on master.
  • This PR touches coverage.yml, so the workflow runs on it. The upload step should show as skipped.

The Coverage Badge workflow runs on pull requests too, and its last step
pushed the badge to the coverage-badge branch every time. A pull request
from a branch in this repository overwrote master's badge with the pull
request's coverage. A pull request from a fork gets a read-only token, so
the push failed with 403 and the check went red even though tests and
coverage passed (seen on #150).

Run the upload step only for push events. Pull requests still run the
suite against live servers and enforce the coverage gate.
@allen0099
allen0099 merged commit 3b26bbd into master Sep 25, 2026
2 of 3 checks passed
allen0099 added a commit that referenced this pull request Sep 25, 2026
…ease

test_the_repository_changelog_can_be_released promotes the real
CHANGELOG.md. Right after a release its `## [Unreleased]` section is
empty, and promote() rightly refuses an empty section, so the test failed
on master from the 0.3.7 release until the next changelog entry. That
turned the Coverage Badge and Test runs red on master and on pull
requests without a changelog entry (#151).

When the section is empty, the test now gives it a placeholder entry
before promoting, so the rest of the file (heading order and the compare
links) is still checked. A non-empty section is left as it is.
@allen0099
allen0099 deleted the ci/coverage-badge-push-only branch September 26, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant