Skip to content

build: fix non-fast-forward push in publish_coverage_pr#13393

Merged
kgryte merged 1 commit into
developfrom
philipp/ci-fix-publish-coverage-pr-checkout-2026-07-09
Jul 9, 2026
Merged

build: fix non-fast-forward push in publish_coverage_pr#13393
kgryte merged 1 commit into
developfrom
philipp/ci-fix-publish-coverage-pr-checkout-2026-07-09

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Resolves #{{N/A}}.

Description

This pull request:

  • Fixes the "Checkout coverage repository branch" step in .github/workflows/publish_coverage_pr.yml, which discarded a PR's existing coverage-report branch history on every run, causing the subsequent push to stdlib-js/www-test-code-coverage to 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:

! [rejected]                pr-13379 -> pr-13379 (fetch first)
error: failed to push some refs to 'https://github.com/stdlib-js/www-test-code-coverage.git'

Root cause: The step ran git fetch origin "$BRANCH_NAME" || true followed by git checkout "$BRANCH_NAME" || git checkout -b "$BRANCH_NAME". Because the repository is freshly checked out each run against only the default branch, the fetch populates FETCH_HEAD but 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_HEAD when 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

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
@Planeshifter Planeshifter marked this pull request as ready for review July 9, 2026 14:54
@Planeshifter Planeshifter requested review from a team and kgryte July 9, 2026 14:54
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Jul 9, 2026
@kgryte kgryte added CI Issue or pull request specific to continuous integration environments. and removed Needs Review A pull request which needs code review. labels Jul 9, 2026
@kgryte kgryte changed the title build(workflows): fix non-fast-forward push in publish_coverage_pr build: fix non-fast-forward push in publish_coverage_pr Jul 9, 2026
@kgryte kgryte merged commit 3b9ad55 into develop Jul 9, 2026
51 checks passed
@kgryte kgryte deleted the philipp/ci-fix-publish-coverage-pr-checkout-2026-07-09 branch July 9, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Issue or pull request specific to continuous integration environments.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants