Update README regarding pull_request_target

This commit is contained in:
ylemkimon 2020-08-09 21:54:36 +09:00 committed by GitHub
parent 2036a08e25
commit 05aa1e5bb4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -119,6 +119,7 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous
- [Checkout pull request HEAD commit instead of merge commit](#Checkout-pull-request-HEAD-commit-instead-of-merge-commit) - [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 closed event](#Checkout-pull-request-on-closed-event)
- [Push a commit using the built-in token](#Push-a-commit-using-the-built-in-token) - [Push a commit using the built-in token](#Push-a-commit-using-the-built-in-token)
- [Checkout pull request on `pull_request_target`](#Checkout-pull-request-on-pull_request_target)
## Fetch all history for all tags and branches ## Fetch all history for all tags and branches
@ -214,6 +215,22 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
``` ```
## 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 }}/head
```
**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 ## Push a commit using the built-in token
```yaml ```yaml