Fix check-merge workflow on PRs from forks #10366
Merged
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.
Changes
Noticed that the
check-marge
workflow was failing for #10189. As noted in the GH docs,GITHUB_TOKEN
has a hard permission limit for PRs from forks. The way to elevate the permissions and "trust" this PR is to use thepull_request_target
event.However, when using that event,
actions/checkout
will only operate on the base branch of the PR. I needed to updateactions/checkout
to checkout the head of the PR instead to fix this. This means we can "trust" the code coming from the PR with the elevatedGITHUB_TOKEN
permissions, but the workflow isn't executing code from the PR so this is safe.tj-actions/changed-files
also have a helpful note about it.Testing
Should work
Docs
n/a