diff --git a/README.md b/README.md index 8fe140f..3826097 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,7 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl - [Checkout multiple repos (private)](#Checkout-multiple-repos-private) - [Checkout pull request HEAD commit instead of merge commit](#Checkout-pull-request-HEAD-commit-instead-of-merge-commit) - [Checkout pull request on closed event](#Checkout-pull-request-on-closed-event) +- [Checkout pull request on `pull_request_target`](#Checkout-pull-request-on-pull_request_target) - [Push a commit using the built-in token](#Push-a-commit-using-the-built-in-token) ## Fetch all history for all tags and branches @@ -212,6 +213,22 @@ jobs: - uses: actions/checkout@v3 ``` +## Checkout pull request on `pull_request_target` + +```yaml +on: + - pull_request_target +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: refs/pull/${{ github.event.pull_request.number }}/merge +``` + +**WARNING! NEVER** run code from pull requests of public repositories! The token of `pull_request_target` event has write access. + ## Push a commit using the built-in token ```yaml