Change the workflow trigger event from pull_request to pull_request_target in the "cleanup caches by a branch" workflow example.
Motivation and Context
When triggered by the pull_request event, the GITHUB_TOKEN does not have permission to delete the cache of the base repository in a cross-repository pull request. This results in the error Error: Resource not accessible by integration.
This problem can be avoided by using the pull_request_target event.
How Has This Been Tested?
I've updated the workflow to use the pull_request_target event and triggered a GitHub Actions run.
Screenshots (if appropriate):
Types of changes
[ ] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
[x] Documentation (add or update README or docs)
Checklist:
[x] My code follows the code style of this project.
[ ] My change requires a change to the documentation.
Description
Change the workflow trigger event from
pull_request
topull_request_target
in the "cleanup caches by a branch" workflow example.Motivation and Context
When triggered by the
pull_request
event, theGITHUB_TOKEN
does not have permission to delete the cache of the base repository in a cross-repository pull request. This results in the errorError: Resource not accessible by integration
. This problem can be avoided by using thepull_request_target
event.How Has This Been Tested?
I've updated the workflow to use the
pull_request_target
event and triggered a GitHub Actions run.Screenshots (if appropriate):
Types of changes
Checklist: