ci: fix coverage badge publish to use git worktree#23669
Open
Surabhi-1605 wants to merge 1 commit into
Open
Conversation
The badge step wrote coverage.svg into the working tree and then ran 'git checkout -B badges', which aborts on the second+ run because the badges branch already tracks coverage.svg (untracked file would be overwritten). Align with the consul-dataplane reference: generate the SVG outside the tree and publish via a separate git worktree, so the main checkout never switches branches. Restores the empty-commit skip and [skip ci] tag.
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
Update coverage badgestep inreusable-coverage-report.ymlwritescoverage.svginto the working tree and then runsgit checkout -B badges origin/badges. On the second and subsequent runs (once thebadgesbranch already trackscoverage.svg), this aborts with:The first run succeeds via the orphan-branch path, so the bug only surfaces on later main pushes.
Fix
/tmp/coverage.svg(never an untracked file in the working tree)git worktree add /tmp/badges-wt— the main checkout never switches branchesgit diff --staged --quiet)[skip ci]so it doesn't trigger another runThe badge step is now byte-for-byte identical to consul-dataplane's. Only the "Update coverage badge" step changes; no other logic is touched.
Verification