From 27dcf6ac1bd1a82ef55f12ceb40862dda4821de0 Mon Sep 17 00:00:00 2001 From: Zijian Zhang <35801754+futrime@users.noreply.github.com> Date: Tue, 13 Oct 2026 11:05:19 +0800 Subject: [PATCH] ci: find the release pull request by its branch to run CI on, never on main release.yml looked it up by its `autorelease: pending` label, which release-please had not yet added for 0.2.0-beta.2: the lookup came back empty and CI was dispatched on main, leaving the release pull request without `ci-ok`. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9ac2ae31..eb218a01 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -129,12 +129,18 @@ jobs: node release-pr.js # A pull request this workflow's token opens or updates starts no `ci-ok` of its own, and - # the branch rule needs one. A dispatch is the one event that token may start. + # the branch rule needs one. A dispatch is the one event that token may start. The pull + # request is found by release-please's branch, not its `autorelease: pending` label, which + # it may not have yet; and never dispatched without one, which would run CI on `main`. - name: Run CI on the release pull request env: GH_TOKEN: ${{ github.token }} BRANCH: ${{ steps.plan.outputs.branch }} run: | - head="$(gh pr list --repo "$GITHUB_REPOSITORY" --base "$BRANCH" --label 'autorelease: pending' \ - --json headRefName --jq '.[0].headRefName')" + head="$(gh pr list --repo "$GITHUB_REPOSITORY" --base "$BRANCH" --state open \ + --json headRefName --jq '[.[].headRefName | select(startswith("release-please--"))][0] // ""')" + if [[ -z "$head" ]]; then + echo "::error::No release pull request is open against $BRANCH." + exit 1 + fi gh workflow run ci.yml --ref "$head" --repo "$GITHUB_REPOSITORY"