diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7bb4b15..d5298e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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: . @@ -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 diff --git a/.github/workflows/cpr-example-command.yml b/.github/workflows/cpr-example-command.yml index d383f45..c14f765 100644 --- a/.github/workflows/cpr-example-command.yml +++ b/.github/workflows/cpr-example-command.yml @@ -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 diff --git a/README.md b/README.md index 0980ba6..f2a42b0 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ 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 @@ -31,10 +31,10 @@ Create Pull Request action will: # 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 @@ -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://: ``` @@ -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: | @@ -152,7 +152,7 @@ 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 @@ -179,7 +179,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 @@ -189,7 +189,7 @@ 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 }} @@ -224,7 +224,7 @@ jobs: - 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 diff --git a/action.yml b/action.yml index 60e3ade..09290a8 100644 --- a/action.yml +++ b/action.yml @@ -81,7 +81,7 @@ outputs: pull-request-head-sha: description: 'The commit SHA of the pull request branch.' runs: - using: 'node12' + using: 'node16' main: 'dist/index.js' branding: icon: 'git-pull-request' diff --git a/dist/index.js b/dist/index.js index f4a2a38..6144a21 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1085,9 +1085,9 @@ function run() { commitMessage: core.getInput('commit-message'), committer: core.getInput('committer'), author: core.getInput('author'), - signoff: core.getInput('signoff') === 'true', + signoff: core.getBooleanInput('signoff'), branch: core.getInput('branch'), - deleteBranch: core.getInput('delete-branch') === 'true', + deleteBranch: core.getBooleanInput('delete-branch'), branchSuffix: core.getInput('branch-suffix'), base: core.getInput('base'), pushToFork: core.getInput('push-to-fork'), @@ -1098,7 +1098,7 @@ function run() { reviewers: utils.getInputAsArray('reviewers'), teamReviewers: utils.getInputAsArray('team-reviewers'), milestone: Number(core.getInput('milestone')), - draft: core.getInput('draft') === 'true' + draft: core.getBooleanInput('draft') }; core.debug(`Inputs: ${(0, util_1.inspect)(inputs)}`); yield (0, create_pull_request_1.createPullRequest)(inputs); diff --git a/docs/concepts-guidelines.md b/docs/concepts-guidelines.md index 4430fc0..f097710 100644 --- a/docs/concepts-guidelines.md +++ b/docs/concepts-guidelines.md @@ -88,7 +88,7 @@ In these cases, you *must supply* the `base` input so the action can rebase chan Workflows triggered by [`pull_request`](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request) events will by default check out a merge commit. Set the `base` input as follows to base the new pull request on the current pull request's branch. ```yml - - uses: peter-evans/create-pull-request@v3 + - uses: peter-evans/create-pull-request@v4 with: base: ${{ github.head_ref }} ``` @@ -96,7 +96,7 @@ Workflows triggered by [`pull_request`](https://docs.github.com/en/actions/refer Workflows triggered by [`release`](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#release) events will by default check out a tag. For most use cases, you will need to set the `base` input to the branch name of the tagged commit. ```yml - - uses: peter-evans/create-pull-request@v3 + - uses: peter-evans/create-pull-request@v4 with: base: main ``` @@ -173,14 +173,14 @@ This action uses [ncc](https://github.com/vercel/ncc) to compile the Node.js cod 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://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) is required. ```yml - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: token: ${{ secrets.PAT }} repository: owner/repo # Make changes to pull request here - - uses: peter-evans/create-pull-request@v3 + - uses: peter-evans/create-pull-request@v4 with: token: ${{ secrets.PAT }} ``` @@ -200,14 +200,14 @@ How to use SSH (deploy keys) with create-pull-request action: ```yml steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} # Make changes to pull request here - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 ``` ### Push pull request branches to a fork @@ -225,11 +225,11 @@ It will use their own fork to push code and create the pull request. 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 + - uses: actions/checkout@v3 # Make changes to pull request here - - uses: peter-evans/create-pull-request@v3 + - uses: peter-evans/create-pull-request@v4 with: token: ${{ secrets.MACHINE_USER_PAT }} push-to-fork: machine-user/fork-of-repository @@ -261,7 +261,7 @@ GitHub App generated tokens are more secure than using a PAT because GitHub App ```yaml steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: tibdex/github-app-token@v1 id: generate-token @@ -272,7 +272,7 @@ GitHub App generated tokens are more secure than using a PAT because GitHub App # Make changes to pull request here - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 with: token: ${{ steps.generate-token.outputs.token }} ``` @@ -301,7 +301,7 @@ The action can use GPG to sign commits with a GPG key that you generate yourself ```yaml steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: crazy-max/ghaction-import-gpg@v3 with: @@ -313,7 +313,7 @@ The action can use GPG to sign commits with a GPG key that you generate yourself # Make changes to pull request here - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 with: token: ${{ secrets.PAT }} committer: example @@ -338,12 +338,12 @@ jobs: - name: Install dependencies run: apk --no-cache add git - - 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 ``` **Ubuntu container example:** @@ -361,10 +361,10 @@ jobs: add-apt-repository -y ppa:git-core/ppa apt-get install -y git - - 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 ``` diff --git a/docs/examples.md b/docs/examples.md index 7930e84..980143c 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -43,14 +43,14 @@ jobs: updateAuthors: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Update AUTHORS run: | git log --format='%aN <%aE>%n%cN <%cE>' | sort -u > AUTHORS - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 with: commit-message: update authors title: Update AUTHORS @@ -74,7 +74,7 @@ jobs: productionPromotion: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: production - name: Reset promotion branch @@ -82,7 +82,7 @@ jobs: git fetch origin main:main git reset --hard main - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 with: branch: production-promotion ``` @@ -107,7 +107,7 @@ jobs: updateChangelog: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Update Changelog @@ -117,7 +117,7 @@ jobs: ./git-chglog -o CHANGELOG.md rm git-chglog - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 with: commit-message: update changelog title: Update Changelog @@ -145,8 +145,8 @@ jobs: update-dep: 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' - name: Update dependencies @@ -154,7 +154,7 @@ jobs: npx -p npm-check-updates ncu -u npm install - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 with: token: ${{ secrets.PAT }} commit-message: Update dependencies @@ -181,8 +181,8 @@ 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 - run: npm ci @@ -205,16 +205,17 @@ jobs: update-dep: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 + - uses: actions/checkout@v3 + - uses: actions/setup-java@v2 with: + distribution: 'temurin' java-version: 1.8 - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Perform dependency resolution and write new lockfiles run: ./gradlew dependencies --write-locks - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 with: token: ${{ secrets.PAT }} commit-message: Update dependencies @@ -242,14 +243,14 @@ jobs: update-dep: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Update dependencies run: | cargo install cargo-edit cargo update cargo upgrade --to-lockfile - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 with: token: ${{ secrets.PAT }} commit-message: Update dependencies @@ -277,7 +278,7 @@ jobs: updateSwagger: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Get Latest Swagger UI Release id: swagger-ui run: | @@ -305,7 +306,7 @@ jobs: # Update current release echo ${{ steps.swagger-ui.outputs.release_tag }} > swagger-ui.version - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 with: commit-message: Update swagger-ui to ${{ steps.swagger-ui.outputs.release_tag }} title: Update SwaggerUI to ${{ steps.swagger-ui.outputs.release_tag }} @@ -340,7 +341,7 @@ jobs: updateFork: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: repository: fork-owner/repo - name: Reset the default branch with upstream changes @@ -349,7 +350,7 @@ jobs: git fetch upstream main:upstream-main git reset --hard upstream-main - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 with: token: ${{ secrets.PAT }} branch: upstream-changes @@ -368,7 +369,7 @@ jobs: format: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Download website run: | wget \ @@ -382,7 +383,7 @@ jobs: --domains quotes.toscrape.com \ http://quotes.toscrape.com/ - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 with: commit-message: update local website copy title: Automated Updates to Local Website Copy @@ -464,7 +465,7 @@ jobs: if: startsWith(github.head_ref, 'autopep8-patches') == false && github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: ${{ github.head_ref }} - name: autopep8 @@ -477,7 +478,7 @@ jobs: run: echo ::set-output name=branch-name::"autopep8-patches/${{ github.head_ref }}" - name: Create Pull Request if: steps.autopep8.outputs.exit-code == 2 - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 with: commit-message: autopep8 action fixes title: Fixes by autopep8 action @@ -511,13 +512,13 @@ jobs: if: startsWith(github.ref, 'refs/heads/') runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 ... someOtherJob: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 ... ``` @@ -535,7 +536,7 @@ The recommended method is to use [`set-output`](https://docs.github.com/en/actio echo ::set-output name=pr_body::"This PR was auto-generated on $(date +%d-%m-%Y) \ by [create-pull-request](https://github.com/peter-evans/create-pull-request)." - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 with: title: ${{ steps.vars.outputs.pr_title }} body: ${{ steps.vars.outputs.pr_body }} @@ -556,7 +557,7 @@ The content must be [escaped to preserve newlines](https://github.community/t/se echo ::set-output name=body::$body - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 with: body: ${{ steps.get-pr-body.outputs.body }} ``` @@ -581,7 +582,7 @@ The template is rendered using the [render-template](https://github.com/chuhlomi bar: that - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 with: body: ${{ steps.template.outputs.result }} ``` diff --git a/docs/updating.md b/docs/updating.md index db64ed3..b33423c 100644 --- a/docs/updating.md +++ b/docs/updating.md @@ -1,3 +1,15 @@ +## Updating from `v3` to `v4` + +### Breaking changes + +- If using self-hosted runners or GitHub Enterprise Server, there are minimum requirements for `v4` to run. See "What's new" below for details. + +### What's new + +- Updated runtime to Node.js 16 + - The action now requires a minimum version of v2.285.0 for the [Actions Runner](https://github.com/actions/runner/releases/tag/v2.285.0). + - If using GitHub Enterprise Server, the action requires [GHES 3.4](https://docs.github.com/en/enterprise-server@3.4/admin/release-notes) or later. + ## Updating from `v2` to `v3` ### Breaking changes @@ -31,7 +43,7 @@ push-to-fork: machine-user/fork-of-repository ``` -### New features +### What's new - The action has been converted to Typescript giving it a significant performance improvement. @@ -66,7 +78,7 @@ If neither `author` or `committer` are set the action will default to making commits as the GitHub Actions bot user. -### New features +### What's new - Unpushed commits made during the workflow before the action runs will now be considered as changes to be raised in the pull request. See [Create your own commits](https://github.com/peter-evans/create-pull-request#create-your-own-commits) for details. - New commits made to the pull request base will now be taken into account when pull requests are updated. diff --git a/package.json b/package.json index b758ea4..86bb83e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "create-pull-request", - "version": "3.0.0", + "version": "4.0.0", "private": true, "description": "Creates a pull request for changes to your repository in the actions workspace", "main": "lib/main.js", diff --git a/src/main.ts b/src/main.ts index 45a1ae8..f3d9171 100644 --- a/src/main.ts +++ b/src/main.ts @@ -12,9 +12,9 @@ async function run(): Promise { commitMessage: core.getInput('commit-message'), committer: core.getInput('committer'), author: core.getInput('author'), - signoff: core.getInput('signoff') === 'true', + signoff: core.getBooleanInput('signoff'), branch: core.getInput('branch'), - deleteBranch: core.getInput('delete-branch') === 'true', + deleteBranch: core.getBooleanInput('delete-branch'), branchSuffix: core.getInput('branch-suffix'), base: core.getInput('base'), pushToFork: core.getInput('push-to-fork'), @@ -25,7 +25,7 @@ async function run(): Promise { reviewers: utils.getInputAsArray('reviewers'), teamReviewers: utils.getInputAsArray('team-reviewers'), milestone: Number(core.getInput('milestone')), - draft: core.getInput('draft') === 'true' + draft: core.getBooleanInput('draft') } core.debug(`Inputs: ${inspect(inputs)}`)