fix(ci): don't fail backport job when fork comment is blocked - #16241
Merged
Conversation
Labeling a merged fork PR with `backport` fires the labeled event, whose GITHUB_TOKEN is read-only for fork-originated pull_request events. The fork-guidance `gh pr comment` then errors and, under `set -e`, aborts the job before the intended skip. Make the comment best-effort. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Adding the
backportlabel to a merged fork PR fires thelabeledevent. Forpull_requestevents originating from a fork, GitHub forcesGITHUB_TOKENto read-only regardless of the job's declaredpull-requests: write. The fork-guidancegh pr commentthen fails withGraphQL: Resource not accessible by integration (addComment), and underset -euo pipefailthe step aborts before the intendedskip(exit 0) — failing the whole job.Example failure: https://github.com/vercel/ai/actions/runs/27725203720/job/82019805216 (firing on #15855).
Summary
Make the fork-guidance comment best-effort (
|| echo ::warning::…) so the job still exits cleanly viaskip. The actual backport path (workflow_dispatch) is unaffected.Manual Verification
The change is shell-only. The failing run above hit the
gh pr commentline and aborted; with|| echo, the script proceeds toskipand exits 0.Checklist