From 2b3f44c3c898468a9966ad939ab02e41a62e9dd0 Mon Sep 17 00:00:00 2001 From: Hongming Wang Date: Sun, 3 May 2026 07:34:24 -0700 Subject: [PATCH] fix(retarget): skip PRs whose head is staging (auto-promote PRs) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The retarget-main-to-staging workflow tries to PATCH base=staging on every bot-authored PR opened against main. Auto-promote staging→main PRs have head=staging, base=main — retargeting them sets head AND base to staging, which GitHub rejects with HTTP 422 "no new commits between base 'staging' and head 'staging'". This started surfacing on PR #2588 (2026-05-03 14:30) once #2586 switched the auto-promote workflow to an App token. Before #2586 the auto-promote PR was authored by github-actions[bot], which the retarget filter happened to skip; now it's molecule-ai[bot], which passes the bot filter and triggers the broken retarget attempt. Add a head-ref != 'staging' guard so auto-promote PRs short-circuit before the PATCH. The existing 422 "duplicate base" detector is left alone — it covers a different operational case. --- .../workflows/retarget-main-to-staging.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/retarget-main-to-staging.yml b/.github/workflows/retarget-main-to-staging.yml index 0c59ca98..5e1ff8bc 100644 --- a/.github/workflows/retarget-main-to-staging.yml +++ b/.github/workflows/retarget-main-to-staging.yml @@ -26,11 +26,22 @@ jobs: runs-on: ubuntu-latest # Only fire for bot-authored PRs. Human CEO PRs (staging→main promotion) # are intentional and pass through. + # + # Head-ref guard: never retarget a PR whose head IS `staging` — those + # are the auto-promote staging→main PRs (opened by molecule-ai[bot] + # since #2586 switched to an App token, which now passes the bot + # filter below). Retargeting head=staging onto base=staging fails + # with HTTP 422 "no new commits between base 'staging' and head + # 'staging'", which used to surface as a noisy red workflow run on + # every auto-promote (caught 2026-05-03 on PR #2588). if: >- - github.event.pull_request.user.type == 'Bot' - || endsWith(github.event.pull_request.user.login, '[bot]') - || github.event.pull_request.user.login == 'app/molecule-ai' - || github.event.pull_request.user.login == 'molecule-ai[bot]' + github.event.pull_request.head.ref != 'staging' + && ( + github.event.pull_request.user.type == 'Bot' + || endsWith(github.event.pull_request.user.login, '[bot]') + || github.event.pull_request.user.login == 'app/molecule-ai' + || github.event.pull_request.user.login == 'molecule-ai[bot]' + ) steps: - name: Retarget PR base to staging id: retarget