From e3bd06c9fd6b6d55e01f3e3a94375202f6a3be06 Mon Sep 17 00:00:00 2001 From: Jeremy McSpadden Date: Fri, 17 Apr 2026 22:45:05 -0500 Subject: [PATCH] fix(release): make merge-back PR step non-fatal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Repos that disable "Allow GitHub Actions to create and approve pull requests" (org-level policy or repo-level setting) cause the "Create PR to merge release back to main" step to fail with a GraphQL 403. That failure cascades: Tag and push, npm publish, GitHub Release creation are all skipped, and the entire release aborts. The merge-back PR is a convenience — it's re-openable manually after the release. Making it non-fatal with continue-on-error lets the rest of the release complete. The step now emits ::warning:: annotations pointing at the manual-recovery command when it fails. Shell pipelines also fall through with `|| echo "::warning::..."` so transient gh CLI failures don't mask the underlying policy issue. Covers the failure mode seen on run 24596079637 where dry-run publish validation passed but the release halted at the PR-creation step. --- .github/workflows/release.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5cea506f0..36fa47aea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -298,23 +298,32 @@ jobs: - name: Create PR to merge release back to main if: ${{ !inputs.dry_run }} + continue-on-error: true env: GH_TOKEN: ${{ github.token }} BRANCH: ${{ needs.validate-version.outputs.branch }} VERSION: ${{ inputs.version }} run: | - EXISTING_PR=$(gh pr list --base main --head "$BRANCH" --state open --json number --jq '.[0].number') + # Non-fatal: repos that disable "Allow GitHub Actions to create and + # approve pull requests" cause this step to fail with GraphQL 403. + # The release itself (tag + npm publish + GitHub Release) must still + # proceed. Open the merge-back PR manually afterwards with: + # gh pr create --base main --head release/${VERSION} \ + # --title "chore: merge release v${VERSION} to main" + EXISTING_PR=$(gh pr list --base main --head "$BRANCH" --state open --json number --jq '.[0].number' 2>/dev/null || echo "") if [ -n "$EXISTING_PR" ]; then echo "PR #$EXISTING_PR already exists; updating" gh pr edit "$EXISTING_PR" \ --title "chore: merge release v${VERSION} to main" \ - --body "Merge release branch back to main after v${VERSION} stable release." + --body "Merge release branch back to main after v${VERSION} stable release." \ + || echo "::warning::Could not update merge-back PR (likely PR-creation policy disabled). Open it manually after release." else gh pr create \ --base main \ --head "$BRANCH" \ --title "chore: merge release v${VERSION} to main" \ - --body "Merge release branch back to main after v${VERSION} stable release." + --body "Merge release branch back to main after v${VERSION} stable release." \ + || echo "::warning::Could not create merge-back PR (likely PR-creation policy disabled). Open it manually after release." fi - name: Tag and push