Skip to content

Commit

Permalink
v4 (#1099)
Browse files Browse the repository at this point in the history
* feat: update action runtime to node 16

* feat: allow add-paths to resolve to no changes

* docs: update readme

* chore: update package lock

* chore: bump dependency

* ci: add dependabot workflow

* docs: update action versions
  • Loading branch information
peter-evans committed Mar 23, 2022
1 parent 0e8dfbd commit d6d5519
Show file tree
Hide file tree
Showing 15 changed files with 291 additions and 185 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependencies"
24 changes: 11 additions & 13 deletions .github/workflows/ci.yml
Expand Up @@ -14,23 +14,21 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: 12.x
- uses: actions/setup-python@v2
with:
python-version: '3.x'
node-version: 16.x
cache: npm
- run: npm ci
- run: npm run build
- run: npm run format-check
- run: npm run lint
- run: npm run test
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: action.yml
path: action.yml
Expand All @@ -43,16 +41,16 @@ jobs:
matrix:
target: [built, committed]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: main
- if: matrix.target == 'built' || github.event_name == 'pull_request'
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- if: matrix.target == 'built' || github.event_name == 'pull_request'
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: action.yml
path: .
Expand Down Expand Up @@ -112,8 +110,8 @@ jobs:
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: dist
path: dist
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cpr-example-command.yml
Expand Up @@ -6,7 +6,7 @@ jobs:
createPullRequest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Make changes to pull request
run: date +%s > report.txt
Expand Down
29 changes: 14 additions & 15 deletions README.md
Expand Up @@ -21,20 +21,20 @@ Create Pull Request action will:

- [Concepts, guidelines and advanced usage](docs/concepts-guidelines.md)
- [Examples](docs/examples.md)
- [Updating to v3](docs/updating.md)
- [Updating to v4](docs/updating.md)

## Usage

```yml
- uses: actions/checkout@v2
- uses: actions/checkout@v3

# Make changes to pull request here

- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v4
```

You can also pin to a [specific release](https://github.com/peter-evans/create-pull-request/releases) version in the format `@v3.x.x`
You can also pin to a [specific release](https://github.com/peter-evans/create-pull-request/releases) version in the format `@v4.x.x`

### Action inputs

Expand All @@ -46,7 +46,7 @@ All inputs are **optional**. If not set, sensible defaults will be used.
| --- | --- | --- |
| `token` | `GITHUB_TOKEN` (permissions `contents: write` and `pull-requests: write`) or a `repo` scoped [Personal Access Token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token). | `GITHUB_TOKEN` |
| `path` | Relative path under `GITHUB_WORKSPACE` to the repository. | `GITHUB_WORKSPACE` |
| `add-paths` | A comma or newline-separated list of file paths to commit. Paths should follow git's [pathspec](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec) syntax. Defaults to adding all new and modified files. See [Add specific paths](#add-specific-paths). | `-A` |
| `add-paths` | A comma or newline-separated list of file paths to commit. Paths should follow git's [pathspec](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec) syntax. If no paths are specified, all new and modified files are added. See [Add specific paths](#add-specific-paths). | |
| `commit-message` | The message to use when committing changes. | `[create-pull-request] automated change` |
| `committer` | The committer name and email address in the format `Display Name <email@address.com>`. Defaults to the GitHub Actions bot user. | `GitHub <noreply@github.com>` |
| `author` | The author name and email address in the format `Display Name <email@address.com>`. Defaults to the user who triggered the workflow run. | `${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>` |
Expand All @@ -68,7 +68,7 @@ All inputs are **optional**. If not set, sensible defaults will be used.
For self-hosted runners behind a corporate proxy set the `https_proxy` environment variable.
```yml
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v4
env:
https_proxy: http://<proxy_address>:<port>
```
Expand All @@ -88,7 +88,7 @@ Note that in order to read the step outputs the action step must have an id.
```yml
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v4
- name: Check outputs
if: ${{ steps.cpr.outputs.pull-request-number }}
run: |
Expand Down Expand Up @@ -147,12 +147,11 @@ If there are files or directories you want to ignore you can simply add them to

You can control which files are committed with the `add-paths` input.
Paths should follow git's [pathspec](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec) syntax.
Each path must resolve to a least one new or modified file to add.
All file changes that do not match one of the paths will be discarded.

```yml
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v4
with:
add-paths: |
*.java
Expand All @@ -166,7 +165,7 @@ Note that the repository must be checked out on a branch with a remote, it won't

```yml
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Create commits
run: |
git config user.name 'Peter Evans'
Expand All @@ -179,7 +178,7 @@ Note that the repository must be checked out on a branch with a remote, it won't
- name: Uncommitted change
run: date +%s > report.txt
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v4
```

### Create a project card
Expand All @@ -189,11 +188,11 @@ To create a project card for the pull request, pass the `pull-request-number` st
```yml
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v4

- name: Create or Update Project Card
if: ${{ steps.cpr.outputs.pull-request-number }}
uses: peter-evans/create-or-update-project-card@v1
uses: peter-evans/create-or-update-project-card@v2
with:
project-name: My project
column-name: My column
Expand All @@ -217,14 +216,14 @@ jobs:
createPullRequest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Make changes to pull request
run: date +%s > report.txt

- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.PAT }}
commit-message: Update report
Expand Down

0 comments on commit d6d5519

Please sign in to comment.