Skip the PR comment on runs that cannot post it - #3
Open
thc1006 wants to merge 1 commit into
Open
Conversation
The comment step fails on every pull request from a fork, and only those: Lint success Format check success Run script success Upload report.html success Comment on PR failure HttpError 403, resource not accessible This repository is public, so a `pull_request` run whose head is a fork gets a read-only GITHUB_TOKEN. `permissions: pull-requests: write` cannot raise that, only narrow what the event already grants. Every earlier run came from a branch on the repository itself, which does get a write token, so the step had not been reached from a fork until ARRC-Rocket#2. Skipped rather than tolerated with continue-on-error: a step that cannot succeed is better not attempted. The report is unaffected either way, since it is uploaded as the `report` artifact one step earlier. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.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.
The
Comment on PRstep fails on every pull request from a fork, which is what #2 ran into. This skips it there.Step by step on that run:
This repository is public, so a
pull_requestrun whose head is a fork gets a read-onlyGITHUB_TOKENregardless of thepermissionsblock, which can only narrow what the event already grants. Every earlier run on this workflow came fromenh/setup-basics, a branch on the repository itself, which does get a write token. So the step had never been reached from a fork before.Skipped rather than wrapped in
continue-on-error, since a step that cannot succeed is better not attempted than tolerated. The report is unaffected: it is uploaded as thereportartifact one step earlier, and internal pull requests still get the comment.This pull request will show the same red until it lands, for the same reason.