Update documentation

This commit is contained in:
Peter Evans 2020-02-08 16:04:23 +09:00
parent 2d18371789
commit c65a4f39b3
2 changed files with 15 additions and 21 deletions

View file

@ -88,6 +88,21 @@ If there is some reason you need to use `actions/checkout@v1` the following step
- run: git checkout "${GITHUB_REF:11}" - run: git checkout "${GITHUB_REF:11}"
``` ```
Checking out a branch from a different repository from where the workflow is executing will make *that repository* the target for the created pull request. In this case, a `repo` scoped [Personal Access Token (PAT)](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) is required.
```yml
- uses: actions/checkout@v2
with:
token: ${{ secrets.PAT }}
repository: owner/repo
# Create changes to pull request here
- uses: peter-evans/create-pull-request@v2
with:
token: ${{ secrets.PAT }}
```
### Branch naming ### Branch naming
For branch naming there are two strategies. Create a fixed-name pull request branch that will be updated with new changes until it is merged or closed, OR, always create a new unique branch each time there are changes to be committed. For branch naming there are two strategies. Create a fixed-name pull request branch that will be updated with new changes until it is merged or closed, OR, always create a new unique branch each time there are changes to be committed.

View file

@ -7,7 +7,6 @@ This document covers terminology, how the action works, and general usage guidel
- [How the action works](#how-the-action-works) - [How the action works](#how-the-action-works)
- [Guidelines](#guidelines) - [Guidelines](#guidelines)
- [Providing a consistent base](#providing-a-consistent-base) - [Providing a consistent base](#providing-a-consistent-base)
- [The pull request target repository](#the-pull-request-target-repository)
- [Pull request events](#pull-request-events) - [Pull request events](#pull-request-events)
- [Restrictions on forked repositories](#restrictions-on-forked-repositories) - [Restrictions on forked repositories](#restrictions-on-forked-repositories)
- [Tag push events](#tag-push-events) - [Tag push events](#tag-push-events)
@ -73,26 +72,6 @@ jobs:
Although rare, there may be use cases where it makes sense to execute the workflow on a branch that is not the base of the pull request. In these cases, the base branch can be specified with the `base` action input. The action will attempt to rebase changes made during the workflow on to the actual base. Although rare, there may be use cases where it makes sense to execute the workflow on a branch that is not the base of the pull request. In these cases, the base branch can be specified with the `base` action input. The action will attempt to rebase changes made during the workflow on to the actual base.
### The pull request target repository
The action determines what repository it should create the pull request in based on the checked out repository.
Checking out a branch from a different repository from where the workflow is executing will make *that repository* the target for the created pull request. In this case, a `repo` scoped [Personal Access Token (PAT)](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) is required.
```yml
- uses: actions/checkout@v2
with:
token: ${{ secrets.PAT }}
repository: owner/repo
- name: Create changes to pull request
run: <create changes here>
- uses: peter-evans/create-pull-request@v2
with:
token: ${{ secrets.PAT }}
```
### Pull request events ### Pull request events
Workflows triggered by `pull_request` events will by default check out a [merge commit](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#pull-request-event-pull_request). To prevent the merge commit being included in created pull requests it is necessary to checkout the `head_ref`. Workflows triggered by `pull_request` events will by default check out a [merge commit](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#pull-request-event-pull_request). To prevent the merge commit being included in created pull requests it is necessary to checkout the `head_ref`.