Repository navigation
fix(ci): publish coverage badges to a dedicated branch instead of main - #23
Merged
Merged
Conversation
The main branch is protected and only accepts changes through pull requests, so EndBug/add-and-commit could never push the regenerated badges back to it (GH006). Publish them to a 'badges' branch instead and point the README at that branch. Dropping the action also removes its deprecated Node 16 / set-output warnings. Co-authored-by: alejandro <alejandro@veryfi.com>
Co-authored-by: alejandro <alejandro@veryfi.com>
Co-authored-by: alejandro <alejandro@veryfi.com>
alejouribesanchez
marked this pull request as ready for review
August 21, 2026 16:50
decim92
approved these changes
Aug 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
Commit Code Coverage Image to Repostep ofVeryfi-php main updatefails on every push tomain:mainis protected and only accepts changes through pull requests, so the built-inGITHUB_TOKENcan never push the regenerated badges to it. No amount of retrying or reconfiguringEndBug/add-and-commitcan succeed against that rule. The same run also emitsset-outputdeprecation warnings from that action (v5 predates environment files) and a Node 20 deprecation warning fromactions/checkout@v2.Fix
Publish the badges to a dedicated, unprotected
badgesbranch instead of committing them tomain..github/scripts/publish_badges.shcommitsmetrics/code_coverage.svgandmetrics/methods_coverage.svgonto thebadgesbranch, creating it as an orphan branch on the first run and appending to it afterwards. It is a no-op when coverage has not changed, so it produces no empty commits, and it keeps theGithub actions <veryfi@veryfi.com>commit identity andUpdate reportmessage the old step used.main.ymlreplaces theEndBug/add-and-commit@v5step with that script, which also removes the deprecatedset-outputwarnings. The workflow declarescontents: writeand amain-updateconcurrency group so concurrent pushes cannot race on the badge branch.actions/checkout@v2is bumped tov5in both workflows, clearing the Node deprecation warning (v4still targets Node 20).php.ymlalso gets an explicit read-onlypermissionsblock.README.mdpoints its badges atraw.githubusercontent.com/veryfi/veryfi-php/badges/metrics/*.svgand now shows methods coverage alongside code coverage.The coverage gate is unchanged:
metrics/generate_badges.pystill fails the build when statement coverage drops below 92%.Verification
PHP Unit testingon this PR is green with zero deprecation warnings in the log (run 32503840817): 179 tests, 676 assertions, badges generated at 97.8% code / 98.9% methods coverage.The publishing step only runs on pushes to
main, so it was verified against a local remote whosemainrejects pushes with the exactGH006message GitHub returns, using the realphpunit --coverage-cloverandgenerate_badges.pyoutput:badgesbranch when it is missing,mainref is never touched, and no worktrees or temporary branches are left behind.The same scenarios were replayed from a
depth=1checkout (whatactions/checkoutproduces) and from a subdirectory.actionlintreports no issues on both workflows andshellcheckreports none on the new script.Note for reviewers
This assumes only
mainis protected. If an organization ruleset requires pull requests on every branch, thebadgesbranch push would be rejected too, and the alternative is a PAT with bypass permission stored as a repository secret.