Update documentation

This commit is contained in:
Peter Evans 2020-07-19 17:01:54 +09:00
parent 216b3681c3
commit 809468fcd7
4 changed files with 102 additions and 77 deletions

View file

@ -138,20 +138,12 @@ There are a number of workarounds with different pros and cons.
From a security perspective it's good practice to fork third-party actions, review the code, and use your fork of the action in workflows.
By using third-party actions directly the risk exists that it could be modified to do something malicious, such as capturing secrets.
This action uses [ncc](https://github.com/zeit/ncc) to compile the Node.js code and dependencies into a single file.
Python dependencies are vendored and committed to the repository [here](https://github.com/peter-evans/create-pull-request/tree/master/dist/vendor).
No dependencies are downloaded during the action execution.
Vendored Python dependencies can be reviewed by rebuilding the [dist](https://github.com/peter-evans/create-pull-request/tree/master/dist) directory and redownloading dependencies.
The following commands require Node and Python 3.
Alternatively, use the action directly and reference the commit hash for the version you want to target.
```
npm install
npm run clean
npm run package
- uses: thirdparty/foo-action@172ec762f2ac8e050062398456fccd30444f8f30
```
The `dist` directory should be rebuilt leaving no git diff.
This action uses [ncc](https://github.com/zeit/ncc) to compile the Node.js code and dependencies into a single Javascript file under the [dist](https://github.com/peter-evans/create-pull-request/tree/master/dist) directory.
## Advanced usage
@ -208,24 +200,17 @@ It will use their own fork to push code and create the pull request.
3. Create a [Personal Access Token (PAT)](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line).
4. Logout and log back in to your main user account.
5. Add a secret to your repository containing the above PAT.
6. As shown in the following example workflow, switch the git remote to the fork's URL after checkout and update the fork to match the checked out branch. Then set the action input `request-to-parent` to `true`.
6. As shown in the following example workflow, set the `push-to-fork` input to the full repository name of the fork.
```yaml
- uses: actions/checkout@v2
with:
persist-credentials: false
- run: |
git remote set-url origin https://${{ secrets.MACHINE_USER_PAT }}:x-oauth-basic@github.com/machine-user/fork-of-repository
git fetch --unshallow -p origin
git push --force
# Make changes to pull request here
- uses: peter-evans/create-pull-request@v2
with:
token: ${{ secrets.MACHINE_USER_PAT }}
request-to-parent: true
push-to-fork: machine-user/fork-of-repository
```
### Authenticating with GitHub App generated tokens
@ -272,7 +257,7 @@ GitHub App generated tokens are more secure than using a PAT because GitHub App
This action can be run inside a container by installing the action's dependencies either in the Docker image itself, or during the workflow.
The action requires `python3`, `pip3` and `git` to be installed and on the `PATH`.
The action requires `git` to be installed and on the `PATH`.
Note that `actions/checkout` requires Git 2.18 or higher to be installed, otherwise it will just download the source of the repository instead of cloning it.
@ -285,9 +270,7 @@ jobs:
image: alpine
steps:
- name: Install dependencies
run: |
apk --no-cache add git python3
python3 -m ensurepip
run: apk --no-cache add git
- uses: actions/checkout@v2
@ -310,7 +293,7 @@ jobs:
apt-get update
apt-get install -y software-properties-common
add-apt-repository -y ppa:git-core/ppa
apt-get install -y python3 python3-pip git
apt-get install -y git
- uses: actions/checkout@v2

View file

@ -1,11 +1,64 @@
# Updating from `v1` to `v2`
## Updating from `v2` to `v3`
## Breaking changes
### Breaking changes
- Deprecated inputs `project` and `project-column` have been removed in favour of an additional action step. See [Create a project card](https://github.com/peter-evans/create-pull-request#create-a-project-card) for details.
- Deprecated output `pr_number` has been removed in favour of `pull-request-number`.
- Input `request-to-parent` has been removed in favour of `push-to-fork`. This greatly simplifies pushing the pull request branch to a fork of the parent repository. See [Push pull request branches to a fork](concepts-guidelines.md#push-pull-request-branches-to-a-fork) for details.
e.g.
```yaml
- uses: actions/checkout@v2
# Make changes to pull request here
- uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.MACHINE_USER_PAT }}
push-to-fork: machine-user/fork-of-repository
```
- Input `branch-suffix` has been removed to simplify the action and make it easier to understand its behaviour. The same functionality can be achieved by modifying the `branch` name before the action runs. See the following example. If you were using `branch-suffix` and need help to update to `v3`, please create an issue.
e.g.
```yaml
- name: Return a 7 character random string
uses: actions/github-script@v2
id: random-string
with:
result-encoding: string
script: return Math.random().toString(36).substr(2, 7)
- uses: peter-evans/create-pull-request@v3
with:
branch: my-branch-${{ steps.random-string.outputs.result }}
```
### New features
- The action has been converted to Typescript and is much faster than `v2`.
- If you run this action in a container, `python` and `pip` are no longer required dependencies. See [Running in a container](concepts-guidelines.md#running-in-a-container) for details.
- Inputs `labels`, `assignees`, `reviewers` and `team-reviewers` can now be newline separated, or comma separated.
e.g.
```yml
labels: |
chore
dependencies
automated
```
## Updating from `v1` to `v2`
### Breaking changes
- `v2` now expects repositories to be checked out with `actions/checkout@v2`
To use `actions/checkout@v1` the following step to checkout the branch is necessary.
```
```yml
- uses: actions/checkout@v1
- name: Checkout branch
run: git checkout "${GITHUB_REF:11}"
@ -18,7 +71,7 @@
If neither `author` or `committer` are set the action will default to making commits as the GitHub Actions bot user.
## New features
### New features
- Unpushed commits made during the workflow before the action runs will now be considered as changes to be raised in the pull request. See [Controlling commits](https://github.com/peter-evans/create-pull-request#controlling-commits) for details.
- New commits made to the pull request base will now be taken into account when pull requests are updated.