Skip to content

Skip the PR build check if the PR already merged - #351

Merged
saqibmanan merged 1 commit into
mainfrom
ci-skip-build-if-already-merged
Sep 28, 2026
Merged

saqibmanan merged 1 commit into
mainfrom
ci-skip-build-if-already-merged

Conversation

@saqibmanan

Copy link
Copy Markdown
Contributor

Two PR build checks failed this morning (#350 and a sibling), both with:

fatal: couldn't find remote ref refs/pull/350/merge

Root cause: marking a CMS entry Ready and clicking Publish happen seconds apart in Decap (13s apart for #350). The build job, triggered by the Ready label since #340, sometimes starts just before the merge and loses the race — its checkout then fails because GitHub drops refs/pull/N/merge the instant the PR merges.

Impact: none. This check was never required to merge (verified against the branch ruleset), so both PRs merged and deployed fine despite the red X. Purely a false alarm.

Fix: skip the build job outright once github.event.pull_request.merged is true, instead of letting checkout fail on a ref that's already gone.

Marking a CMS entry Ready and clicking Publish happen seconds apart in
Decap. The build job (triggered by the Ready label) sometimes starts
just before the merge, and its checkout then fails with 'couldn't
find remote ref refs/pull/N/merge' once GitHub drops that ref on
merge — a false alarm, since this check was never required to merge
and the content lands on main fine either way. Skip the job outright
once the PR is already merged, instead of letting checkout fail.
@saqibmanan
saqibmanan merged commit b1653b0 into main Sep 28, 2026
2 checks passed
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