Skip to content

fix(coverage): skip cleanly when PR head branch was deleted by auto-merge#1

Closed
fredbi wants to merge 4 commits into
fredbi:masterfrom
go-openapi:fix/coverage-skip-on-deleted-branch
Closed

fix(coverage): skip cleanly when PR head branch was deleted by auto-merge#1
fredbi wants to merge 4 commits into
fredbi:masterfrom
go-openapi:fix/coverage-skip-on-deleted-branch

Conversation

@fredbi

@fredbi fredbi commented May 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • The collect-coverage job is intentionally not a required check (codecov uploads are flaky). Auto-merge can therefore fire before it runs, and GitHub's auto-delete-branch policy removes the PR head — leaving the subsequent actions/checkout to fail with a noisy "Reference not found" error and a red status on an already-merged PR.
  • Add a precheck step that queries the GitHub API for the head branch. If it's gone, emit a ::notice and gate the remaining steps off so the job conclusion stays green. Normal PRs (branch still present) are unaffected — coverage uploads as before, and real failures still surface.
  • collect-reports.yml does not need the same fix: it has no checkout step (downloads artifacts by run_id, uses head.sha as a literal value).

Test plan

  • Trigger an auto-merge bot PR on a consumer repo (e.g. strfmt) and verify the merged PR's collect-coverage job is green with a "skip-coverage" notice instead of red.
  • Open a normal PR (no auto-merge) and verify coverage still uploads to codecov as before.
  • Manually retry a collect-coverage run on a PR whose branch was deleted post-merge — should now finish green.

🤖 Generated with Claude Code

fredbi and others added 4 commits May 31, 2026 08:10
…identity (#203)

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
…user, not a bot

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
…mation

Skills under .claude/skills/ are now versioned and shared publicly for
this repo (unlike most others, where they stay user-local). This commit
flips the ignore rule and seeds the directory with:

- github-actions.md: general workflow patterns, repo architecture,
  bot-credentials / wait-pending-jobs recipes, TOCTOU race handling.
- golang-monorepo.md: testing, linting, fuzz, and module layout for
  the ci-workflows / gh-actions split.
- dependabot-automation.md (new): captures the hard-won lesson that
  Dependabot rejects all user.type == "Bot" identities (including
  GitHub App installation tokens), regardless of token permissions.
  Documents the dual bot-go-openapi identities (App vs. user account),
  the PAT-based identity swap used by monitor-bot-pr.yml, and the
  anti-patterns we tried first.

CLAUDE.md updated to point at the new skill.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
…erge

The collect-coverage job is intentionally not a required check (codecov
uploads are flaky), so auto-merge can fire before it runs. When that
happens, GitHub's auto-delete-branch policy removes the PR head and the
checkout step fails with a noisy "Reference not found" error, leaving a
red status on an otherwise successful merge.

Add a precheck step that queries the GitHub API for the head branch.
If it's gone, emit a notice and gate the remaining steps off, so the
job conclusion stays green. Normal PRs (branch still exists) are
unaffected -- coverage is still uploaded and real failures still
surface.

collect-reports.yml does not need the same fix: it has no checkout
step (downloads artifacts by run_id, uses head.sha as a literal value).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
@fredbi fredbi closed this Jun 8, 2026
@fredbi fredbi deleted the fix/coverage-skip-on-deleted-branch branch June 8, 2026 19:39
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