From 4dc3a6a0578610cd0382f4e0217c3366b81f4df0 Mon Sep 17 00:00:00 2001 From: Saqib Date: Mon, 28 Sep 2026 14:14:42 +0530 Subject: [PATCH] Skip the PR build check if the PR already merged MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .github/workflows/gh-pages.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 8df3f3e4..3bf8ebe1 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -15,9 +15,15 @@ jobs: # build once the entry is marked Ready (Decap's pending_publish label), and on # later saves while it stays Ready. Other PRs build as before; `labeled` is # only listened to for the CMS case. + # + # Marking Ready and clicking Publish happen seconds apart in Decap, so this + # job sometimes starts just before the merge and loses the race: checkout + # then fails with "couldn't find remote ref refs/pull/N/merge" because + # GitHub drops that ref the moment the PR merges. Not a real failure (this + # check was never required to merge), just a false alarm — skip instead. build: if: >- - github.event_name == 'pull_request' && ( + github.event_name == 'pull_request' && !github.event.pull_request.merged && ( startsWith(github.head_ref, 'cms/') && contains(github.event.pull_request.labels.*.name, 'decap-cms/pending_publish') || !startsWith(github.head_ref, 'cms/') && github.event.action != 'labeled'