-
Notifications
You must be signed in to change notification settings - Fork 2k
Update README regarding pull_request_target
#321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,6 +118,7 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous | |
- [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 | ||
|
@@ -214,6 +215,22 @@ jobs: | |
- 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. | ||
This comment was marked as resolved.
Sorry, something went wrong. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @matfax The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've tested various things now. Even though GITHUB_TOKEN doesn't seem to be available all the time, the |
||
|
||
## Push a commit using the built-in token | ||
|
||
```yaml | ||
|
Uh oh!
There was an error while loading. Please reload this page.