actions / cache

Cache dependencies and build outputs in GitHub Actions
MIT License
4.49k stars 1.2k forks source link

docs: fix cleanup example to use pull_request_target trigger #1312

Open Mogyuchi opened 8 months ago

Mogyuchi commented 8 months ago

Description

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

Checklist: