build: fix non-fast-forward push in publish_coverage_pr#13393
Merged
kgryte merged 1 commit intoJul 9, 2026
Conversation
The job `Publish PR coverage results` on workflow `publish_coverage_pr` failed on develop with `! [rejected] pr-<N> -> pr-<N> (fetch first)` pushing to `stdlib-js/www-test-code-coverage`. Root cause: the "Checkout coverage repository branch" step ran `git fetch origin "$BRANCH_NAME" || true` followed by `git checkout "$BRANCH_NAME" || git checkout -b "$BRANCH_NAME"`. Because the repository is a fresh, narrow checkout each run, the fetch only populates FETCH_HEAD and never a local or remote-tracking ref, so the checkout always fell through to creating a new branch from the current default-branch HEAD, discarding any commits an earlier coverage run for the same PR had already pushed. The later commit-and-push step then rejected as non-fast-forward. This commit checks out FETCH_HEAD when the fetch succeeds, resuming the branch's actual remote history, and only falls back to a fresh branch when the fetch fails (first coverage run for a PR), so subsequent pushes fast-forward cleanly. Ref: https://github.com/stdlib-js/stdlib/actions/runs/28999588120
kgryte
approved these changes
Jul 9, 2026
publish_coverage_prpublish_coverage_pr
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.
Resolves #{{N/A}}.
Description
This pull request:
.github/workflows/publish_coverage_pr.yml, which discarded a PR's existing coverage-report branch history on every run, causing the subsequent push tostdlib-js/www-test-code-coverageto be rejected as non-fast-forward.Related Issues
None.
Questions
No.
Other
Failing run: https://github.com/stdlib-js/stdlib/actions/runs/28999588120 (also reproduced on https://github.com/stdlib-js/stdlib/actions/runs/28982083930)
Symptom:
Root cause: The step ran
git fetch origin "$BRANCH_NAME" || truefollowed bygit checkout "$BRANCH_NAME" || git checkout -b "$BRANCH_NAME". Because the repository is freshly checked out each run against only the default branch, the fetch populatesFETCH_HEADbut never a local or remote-tracking ref for$BRANCH_NAME, so the checkout always fell through to creating a new branch from the current default-branch HEAD. This discarded any commits an earlier coverage run for the same PR had already pushed, so the later push was a non-fast-forward relative to the real remote branch and got rejected.Fix: Check out
FETCH_HEADwhen the fetch succeeds (resuming the branch's actual remote history), and only fall back to a fresh branch when the fetch fails (i.e., the first coverage run for a given PR). Subsequent pushes then fast-forward cleanly.Validation: Verified YAML syntax with
python3 -c "import yaml; yaml.safe_load(...)". Reviewed by three independent passes (correctness, regression scope, style/conventions); all approved with no blocking findings. Reviewer A additionally confirmed no other explanation fits the observed rejection and that the fallback branch (no local branch pre-exists on a fresh checkout) is safe. Reviewer B confirmed no other workflow has the same anti-pattern and that no other step in this file is affected.Checklist
AI Assistance
Yes
No
Code generation (e.g., when writing an implementation or fixing a bug)
Test/benchmark generation
Documentation (including examples)
Research and understanding
Disclosure
This PR was written primarily by Claude Code as part of an automated CI-failure triage and fix routine, based on live GitHub Actions job log analysis. The fix was reviewed by three independent automated review passes before being proposed here; all three approved with no blocking findings.
@stdlib-js/reviewers
Generated by Claude Code