Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(gha): Use
pull_request_target
for acceptance workflow (#21600)
This changes our visual snapshots/acceptance workflow to use the `pull_request_target` event instead of `pull_request` so that we can have Visual Snapshots working on fork PRs. By default, forks do not have write access tokens, but when using `pull_request_target`, forked PRs will use the base repository workflows as the source. This ensures that secrets/apis do not get exposed from by the fork changing workflows. See https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#pull_request_target for more information. Important notes about `pull_request_target`: - Used to allow forks to have write-access tokens + secrets - Ensures safety by only running workflow from the main branch - You can test workflow changes by making your branch the base branch in a Pull Request - Note that the workflow seems to be cached after opening the PR - e.g. if you make a pull request against a feature branch, the workflow that will be used is the workflow in the base branch at the point when you create the PR. From there on, you won't be able to change the workflow that is run - You must specify the ref + repository when using the checkout action
- Loading branch information