Skip to content

Commit ebc5e02

Browse files
authored
Merge pull request #429 from peter-evans/dev
v3
2 parents 40e70b8 + c01f8fa commit ebc5e02

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+12122
-6614
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@ jobs:
2222
with:
2323
python-version: '3.x'
2424
- run: npm ci
25-
- run: npm run clean
2625
- run: npm run build
2726
- run: npm run format-check
2827
- run: npm run lint
2928
- run: npm run test
30-
- run: npm run package
3129
- uses: actions/upload-artifact@v2
3230
with:
3331
name: dist
@@ -106,7 +104,7 @@ jobs:
106104
body: |
107105
Full test suite slash command (repository admin only)
108106
```
109-
/test repository=${{ github.event.pull_request.head.repo.full_name }} branch=${{ github.event.pull_request.head.ref }} build=true
107+
/test repository=${{ github.event.pull_request.head.repo.full_name }} ref=${{ github.event.pull_request.head.ref }} build=true
110108
```
111109
112110
package:

.github/workflows/cpr-example-command.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,34 @@ jobs:
88
steps:
99
- uses: actions/checkout@v2
1010

11-
- name: Create report file
11+
- name: Make changes to pull request
1212
run: date +%s > report.txt
1313

1414
- name: Create Pull Request
1515
id: cpr
1616
uses: ./
1717
with:
18-
commit-message: Add report file
18+
commit-message: Update report
1919
committer: GitHub <[email protected]>
2020
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
21-
title: '[Example] Add report file'
21+
title: '[Example] Update report'
2222
body: |
23-
New report
24-
- Contains *today's* date
23+
Update report
24+
- Updated with *today's* date
2525
- Auto-generated by [create-pull-request][1]
2626
2727
[1]: https://github.com/peter-evans/create-pull-request
28-
labels: report, automated pr
28+
labels: |
29+
report
30+
automated pr
2931
assignees: peter-evans
3032
reviewers: peter-evans
3133
milestone: 1
3234
draft: false
3335
branch: example-patches
34-
request-to-parent: false
3536

36-
- name: Check outputs
37+
- name: Check output
3738
run: |
38-
echo "Pull Request Number - ${{ env.PULL_REQUEST_NUMBER }}"
3939
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
4040
4141
- name: Add reaction

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
__pycache__
2-
.python-version
3-
41
lib/
52
node_modules/
63

README.md

Lines changed: 43 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -21,57 +21,54 @@ Create Pull Request action will:
2121

2222
- [Concepts, guidelines and advanced usage](docs/concepts-guidelines.md)
2323
- [Examples](docs/examples.md)
24-
- [Updating from v1](docs/updating.md)
24+
- [Updating to v3](docs/updating.md)
2525

2626
## Usage
2727

2828
```yml
2929
- name: Create Pull Request
30-
uses: peter-evans/create-pull-request@v2
30+
uses: peter-evans/create-pull-request@v3
3131
```
3232
33-
You can also pin to a [specific release](https://github.com/peter-evans/create-pull-request/releases) version in the format `@v2.x.x`
33+
You can also pin to a [specific release](https://github.com/peter-evans/create-pull-request/releases) version in the format `@v3.x.x`
3434

3535
### Action inputs
3636

37-
All inputs are **optional**. If not set, sensible default values will be used.
37+
All inputs are **optional**. If not set, sensible defaults will be used.
3838

3939
**Note**: If you want pull requests created by this action to trigger an `on: push` or `on: pull_request` workflow then you cannot use the default `GITHUB_TOKEN`. See the [documentation here](https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#triggering-further-workflow-runs) for workarounds.
4040

4141
| Name | Description | Default |
4242
| --- | --- | --- |
43-
| `token` | `GITHUB_TOKEN` or a `repo` scoped [PAT](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line). | `GITHUB_TOKEN` |
43+
| `token` | `GITHUB_TOKEN` or 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). | `GITHUB_TOKEN` |
4444
| `path` | Relative path under `GITHUB_WORKSPACE` to the repository. | `GITHUB_WORKSPACE` |
4545
| `commit-message` | The message to use when committing changes. | `[create-pull-request] automated change` |
46-
| `committer` | The committer name and email address in the format `Display Name <[email protected]>`. | Defaults to the GitHub Actions bot user. See [Committer and author](#committer-and-author) for details. |
47-
| `author` | The author name and email address in the format `Display Name <[email protected]>`. | Defaults to the GitHub Actions bot user. See [Committer and author](#committer-and-author) for details. |
46+
| `committer` | The committer name and email address in the format `Display Name <[email protected]>`. Defaults to the GitHub Actions bot user. | `GitHub <[email protected]>` |
47+
| `author` | The author name and email address in the format `Display Name <[email protected]>`. Defaults to the user who triggered the workflow run. | `${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>` |
48+
| `branch` | The pull request branch name. | `create-pull-request/patch` |
49+
| `branch-suffix` | The branch suffix type when using the alternative branching strategy. Valid values are `random`, `timestamp` and `short-commit-hash`. See [Alternative strategy](#alternative-strategy---always-create-a-new-pull-request-branch) for details. | |
50+
| `base` | Sets the pull request base branch. | Defaults to the branch checked out in the workflow. |
51+
| `push-to-fork` | A fork of the checked out parent repository to which the pull request branch will be pushed. e.g. `owner/repo-fork`. The pull request will be created to merge the fork's branch into the parent's base. See [push pull request branches to a fork](https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#push-pull-request-branches-to-a-fork) for details. | |
4852
| `title` | The title of the pull request. | `Changes by create-pull-request action` |
4953
| `body` | The body of the pull request. | `Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action` |
50-
| `labels` | A comma separated list of labels. | |
51-
| `assignees` | A comma separated list of assignees (GitHub usernames). | |
52-
| `reviewers` | A comma separated list of reviewers (GitHub usernames) to request a review from. | |
53-
| `team-reviewers` | A comma separated list of GitHub teams to request a review from. A `repo` scoped [PAT](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) may be required. See [this issue](https://github.com/peter-evans/create-pull-request/issues/155). | |
54+
| `labels` | A comma or newline separated list of labels. | |
55+
| `assignees` | A comma or newline separated list of assignees (GitHub usernames). | |
56+
| `reviewers` | A comma or newline separated list of reviewers (GitHub usernames) to request a review from. | |
57+
| `team-reviewers` | A comma or newline separated list of GitHub teams to request a review from. Note that a `repo` scoped [PAT](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) may be required. See [this issue](https://github.com/peter-evans/create-pull-request/issues/155). | |
5458
| `milestone` | The number of the milestone to associate this pull request with. | |
55-
| `project` | *Deprecated*. See [Create a project card](#create-a-project-card) for details. | |
56-
| `project-column` | *Deprecated*. See [Create a project card](#create-a-project-card) for details. | |
5759
| `draft` | Create a [draft pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests#draft-pull-requests). | `false` |
58-
| `branch` | The branch name. See [Action behaviour](#action-behaviour) for details. | `create-pull-request/patch` |
59-
| `request-to-parent` | Create the pull request in the parent repository of the checked out fork. See [push pull request branches to a fork](https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#push-pull-request-branches-to-a-fork) for details. | `false` |
60-
| `base` | Sets the pull request base branch. | Defaults to the branch checked out in the workflow. |
61-
| `branch-suffix` | The branch suffix type. Valid values are `random`, `timestamp` and `short-commit-hash`. See [Action behaviour](#action-behaviour) for details. | |
6260

6361
### Action outputs
6462

65-
The pull request number is output as both an environment variable and a step output.
63+
The pull request number is output as a step output.
6664
Note that in order to read the step output the action step must have an id.
6765

6866
```yml
6967
- name: Create Pull Request
7068
id: cpr
71-
uses: peter-evans/create-pull-request@v2
69+
uses: peter-evans/create-pull-request@v3
7270
- name: Check outputs
7371
run: |
74-
echo "Pull Request Number - ${{ env.PULL_REQUEST_NUMBER }}"
7572
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
7673
```
7774

@@ -103,8 +100,8 @@ For further details about how the action works and usage guidelines, see [Concep
103100

104101
#### Alternative strategy - Always create a new pull request branch
105102

106-
For some use cases it *may* be desirable to always create a new unique branch each time there are changes to be committed.
107-
This strategy is not recommended and mainly kept for backwards compatibility.
103+
For some use cases it may be desirable to always create a new unique branch each time there are changes to be committed.
104+
This strategy is *not recommended* because if not used carefully it could result in multiple pull requests being created unnecessarily. If in doubt, use the [default strategy](#action-behaviour) of creating an updating a fixed-name branch.
108105

109106
To use this strategy, set input `branch-suffix` with one of the following options.
110107

@@ -114,23 +111,6 @@ To use this strategy, set input `branch-suffix` with one of the following option
114111

115112
- `short-commit-hash` - Commits will be made to a branch suffixed with the short SHA1 commit hash. e.g. `create-pull-request/patch-fcdfb59`, `create-pull-request/patch-394710b`
116113

117-
### Ignoring files
118-
119-
If there are files or directories you want to ignore you can simply add them to a `.gitignore` file at the root of your repository. The action will respect this file.
120-
121-
### Committer and author
122-
123-
If neither `committer` or `author` inputs are supplied the action will default to making commits that appear to be made by the GitHub Actions bot user.
124-
125-
The following configuration can be used to have commits authored by the user who triggered the workflow event.
126-
```yml
127-
- name: Create Pull Request
128-
uses: peter-evans/create-pull-request@v2
129-
with:
130-
committer: GitHub <[email protected]>
131-
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
132-
```
133-
134114
### Controlling commits
135115

136116
As well as relying on the action to handle uncommitted changes, you can additionally make your own commits before the action runs.
@@ -150,17 +130,21 @@ As well as relying on the action to handle uncommitted changes, you can addition
150130
- name: Uncommitted change
151131
run: date +%s > report.txt
152132
- name: Create Pull Request
153-
uses: peter-evans/create-pull-request@v2
133+
uses: peter-evans/create-pull-request@v3
154134
```
155135

136+
### Ignoring files
137+
138+
If there are files or directories you want to ignore you can simply add them to a `.gitignore` file at the root of your repository. The action will respect this file.
139+
156140
### Create a project card
157141

158142
To create a project card for the pull request, pass the `pull-request-number` step output to [create-or-update-project-card](https://github.com/peter-evans/create-or-update-project-card) action.
159143

160144
```yml
161145
- name: Create Pull Request
162146
id: cpr
163-
uses: peter-evans/create-pull-request@v2
147+
uses: peter-evans/create-pull-request@v3
164148
165149
- name: Create or Update Project Card
166150
uses: peter-evans/create-or-update-project-card@v1
@@ -184,34 +168,39 @@ jobs:
184168
runs-on: ubuntu-latest
185169
steps:
186170
- uses: actions/checkout@v2
187-
- name: Create report file
171+
172+
- name: Make changes to pull request
188173
run: date +%s > report.txt
174+
189175
- name: Create Pull Request
190176
id: cpr
191-
uses: peter-evans/create-pull-request@v2
177+
uses: peter-evans/create-pull-request@v3
192178
with:
193-
token: ${{ secrets.GITHUB_TOKEN }}
194-
commit-message: Add report file
179+
token: ${{ secrets.PAT }}
180+
commit-message: Update report
195181
committer: GitHub <[email protected]>
196182
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
197-
title: '[Example] Add report file'
183+
branch: example-patches
184+
title: '[Example] Update report'
198185
body: |
199-
New report
200-
- Contains *today's* date
186+
Update report
187+
- Updated with *today's* date
201188
- Auto-generated by [create-pull-request][1]
202189
203190
[1]: https://github.com/peter-evans/create-pull-request
204-
labels: report, automated pr
191+
labels: |
192+
report
193+
automated pr
205194
assignees: peter-evans
206195
reviewers: peter-evans
207-
team-reviewers: owners, maintainers
196+
team-reviewers: |
197+
owners
198+
maintainers
208199
milestone: 1
209200
draft: false
210-
branch: example-patches
211-
request-to-parent: false
212-
- name: Check outputs
201+
202+
- name: Check output
213203
run: |
214-
echo "Pull Request Number - ${{ env.PULL_REQUEST_NUMBER }}"
215204
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
216205
```
217206

0 commit comments

Comments
 (0)