Compare commits

..

17 Commits

Author SHA1 Message Date
01f7dd1d28 Merge pull request #829 from peter-evans/logging
fix: improve logging
2021-05-14 13:58:45 +09:00
32c71c837c fix: improve logging 2021-05-14 13:47:55 +09:00
a6d621d73e Merge pull request #820 from peter-evans/dependabot/npm_and_yarn/hosted-git-info-2.8.9
build(deps): bump hosted-git-info from 2.8.8 to 2.8.9
2021-05-13 13:18:59 +09:00
09f51e6391 Merge pull request #819 from peter-evans/dependabot/npm_and_yarn/lodash-4.17.21
build(deps): bump lodash from 4.17.19 to 4.17.21
2021-05-13 13:09:37 +09:00
ed04db61de build(deps): bump hosted-git-info from 2.8.8 to 2.8.9
Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-13 03:57:30 +00:00
ea6b55fc9d build(deps): bump lodash from 4.17.19 to 4.17.21
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.19 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.19...4.17.21)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-13 03:57:16 +00:00
88896f707d Merge pull request #816 from peter-evans/update-distribution
Update distribution
2021-05-13 12:51:15 +09:00
423630f7c0 build: update distribution 2021-05-13 03:50:34 +00:00
66cc0cc1e2 Merge pull request #776 from peter-evans/update-dependencies
Update dependencies
2021-05-13 12:48:13 +09:00
2a63057d1e chore: update dependencies 2021-05-13 02:16:24 +00:00
f83efdc34a docs: update default branch 2021-05-13 09:53:24 +09:00
fff683e9ca docs: update default branch 2021-05-13 09:43:00 +09:00
9f83247b25 ci: update default branch 2021-05-13 09:42:47 +09:00
670e508eb6 docs: update readme 2021-05-11 10:12:39 +09:00
d9d6fd980e Merge pull request #804 from peter-evans/gpg-sign-fix
fix: remove unnecessary gpg-sign input
2021-05-10 09:19:01 +09:00
8bb8511e4d fix: remove unnecessary gpg-sign input 2021-05-10 09:01:53 +09:00
c1d92ef456 docs: update readme 2021-05-09 14:44:37 +09:00
15 changed files with 952 additions and 855 deletions

View File

@ -1,12 +1,12 @@
name: CI
on:
push:
branches: [master]
branches: [main]
paths-ignore:
- 'README.md'
- 'docs/**'
pull_request:
branches: [master]
branches: [main]
paths-ignore:
- 'README.md'
- 'docs/**'
@ -45,7 +45,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: master
ref: main
- if: matrix.target == 'built' || github.event_name == 'pull_request'
uses: actions/download-artifact@v2
with:
@ -108,7 +108,7 @@ jobs:
```
package:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: [test]
runs-on: ubuntu-latest
steps:
@ -123,7 +123,7 @@ jobs:
commit-message: 'build: update distribution'
title: Update distribution
body: |
- Updates the distribution for changes on `master`
- Updates the distribution for changes on `main`
Auto-generated by [create-pull-request][1]

View File

@ -44,13 +44,12 @@ All inputs are **optional**. If not set, sensible defaults will be used.
| Name | Description | Default |
| --- | --- | --- |
| `token` | `GITHUB_TOKEN` or a `repo` scoped [Personal Access Token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token). | `GITHUB_TOKEN` |
| `token` | `GITHUB_TOKEN` (`contents: write`, `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` |
| `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>` |
| `signoff` | Add [`Signed-off-by`](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---signoff) line by the committer at the end of the commit log message. | `false` |
| `gpg-sign` | GPG-sign commits. See [GPG commit signature verification](docs/concepts-guidelines.md#gpg-commit-signature-verification) for details. | `false` |
| `branch` | The pull request branch name. | `create-pull-request/patch` |
| `delete-branch` | Delete the `branch` when closing pull requests, and when undeleted after merging. Recommend `true`. | `false` |
| `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. | |
@ -158,6 +157,11 @@ To create a project card for the pull request, pass the `pull-request-number` st
issue-number: ${{ steps.cpr.outputs.pull-request-number }}
```
### Auto-merge
Auto-merge can be enabled on a pull request allowing it to be automatically merged once requirements have been satisfied.
See [enable-pull-request-automerge](https://github.com/peter-evans/enable-pull-request-automerge) action for usage details.
## Reference Example
The following workflow sets many of the action's inputs for reference purposes.

View File

@ -220,7 +220,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('none')
@ -237,7 +236,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -265,7 +263,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('updated')
@ -286,7 +283,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -314,7 +310,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('updated')
@ -337,7 +332,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -366,7 +360,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('not-updated')
@ -387,7 +380,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -424,7 +416,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('updated')
@ -455,7 +446,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -483,7 +473,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('updated')
@ -504,7 +493,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -544,7 +532,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('updated')
@ -571,7 +558,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -614,7 +600,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('updated')
@ -636,7 +621,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -667,7 +651,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('updated')
@ -693,7 +676,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -728,7 +710,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('updated')
@ -756,7 +737,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -799,7 +779,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('updated')
@ -826,7 +805,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
FORK_REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -855,7 +833,6 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
FORK_REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('updated')
@ -877,8 +854,7 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
true,
false
true
)
expect(result.action).toEqual('created')
expect(await getFileContent(TRACKED_FILE)).toEqual(changes.tracked)
@ -913,8 +889,7 @@ describe('create-or-update-branch tests', () => {
'',
BRANCH,
REMOTE_NAME,
true,
false
true
)
expect(_result.action).toEqual('updated')
expect(_result.hasDiffWithBase).toBeTruthy()
@ -945,7 +920,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('none')
@ -965,7 +939,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -996,7 +969,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('updated')
@ -1020,7 +992,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -1051,7 +1022,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('updated')
@ -1077,7 +1047,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -1109,7 +1078,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('not-updated')
@ -1133,7 +1101,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -1173,7 +1140,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('updated')
@ -1207,7 +1173,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -1238,7 +1203,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('updated')
@ -1264,7 +1228,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -1307,7 +1270,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('updated')
@ -1337,7 +1299,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -1383,7 +1344,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('updated')
@ -1408,7 +1368,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -1442,7 +1401,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('updated')
@ -1471,7 +1429,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -1509,7 +1466,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('updated')
@ -1540,7 +1496,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -1586,7 +1541,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('updated')
@ -1616,7 +1570,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
FORK_REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -1648,7 +1601,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
FORK_REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('updated')
@ -1677,7 +1629,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -1710,7 +1661,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('updated')
@ -1736,7 +1686,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(result.action).toEqual('created')
@ -1777,7 +1726,6 @@ describe('create-or-update-branch tests', () => {
BASE,
BRANCH,
REMOTE_NAME,
false,
false
)
expect(_result.action).toEqual('updated')

View File

@ -24,9 +24,6 @@ inputs:
signoff:
description: 'Add `Signed-off-by` line by the committer at the end of the commit log message.'
default: false
gpg-sign:
description: 'GPG-sign commits.'
default: false
branch:
description: 'The pull request branch name.'
default: 'create-pull-request/patch'

820
dist/index.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -29,37 +29,37 @@
orientation: "vertical-reverse"
});
const master = gitgraph.branch("master");
master.commit("Last commit on base");
const localMaster = gitgraph.branch("<#1> master (local)");
localMaster.commit({
const main = gitgraph.branch("main");
main.commit("Last commit on base");
const localMain = gitgraph.branch("<#1> main (local)");
localMain.commit({
subject: "<uncommitted changes>",
body: "Changes to the local base during the workflow",
})
const remotePatch = gitgraph.branch("create-pull-request/patch");
remotePatch.merge({
branch: localMaster,
branch: localMain,
commitOptions: {
subject: "[create-pull-request] automated change",
body: "Changes pushed to create the remote branch",
},
});
master.commit("New commit on base");
main.commit("New commit on base");
const localMaster2 = gitgraph.branch("<#2> master (local)");
localMaster2.commit({
const localMain2 = gitgraph.branch("<#2> main (local)");
localMain2.commit({
subject: "<uncommitted changes>",
body: "Changes to the updated local base during the workflow",
})
remotePatch.merge({
branch: localMaster2,
branch: localMain2,
commitOptions: {
subject: "[create-pull-request] automated change",
body: "Changes force pushed to update the remote branch",
},
});
master.merge(remotePatch);
main.merge(remotePatch);
</script>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

After

Width:  |  Height:  |  Size: 108 KiB

View File

@ -98,7 +98,7 @@ Workflows triggered by [`release`](https://docs.github.com/en/actions/reference/
```yml
- uses: peter-evans/create-pull-request@v3
with:
base: master
base: main
```
### Restrictions on repository forks
@ -164,7 +164,7 @@ Alternatively, use the action directly and reference the commit hash for the ver
- uses: thirdparty/foo-action@172ec762f2ac8e050062398456fccd30444f8f30
```
This action uses [ncc](https://github.com/vercel/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.
This action uses [ncc](https://github.com/vercel/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/main/dist) directory.
## Advanced usage
@ -293,7 +293,7 @@ The action can use GPG to sign commits with a GPG key that you generate yourself
5. Create another repository secret for the key's passphrase, if applicable. e.g. `GPG_PASSPHRASE`
6. The following example workflow shows how to use [crazy-max/ghaction-import-gpg](https://github.com/crazy-max/ghaction-import-gpg) to import your GPG key and instruct the action to sign commits by setting the `gpg-sign` input to `true`.
6. The following example workflow shows how to use [crazy-max/ghaction-import-gpg](https://github.com/crazy-max/ghaction-import-gpg) to import your GPG key and allow the action to sign commits.
Note that the `committer` email address *MUST* match the email address used to create your GPG key.
@ -315,7 +315,6 @@ The action can use GPG to sign commits with a GPG key that you generate yourself
with:
token: ${{ secrets.PAT }}
committer: example <email@example.com>
gpg-sign: true
```
### Running in a container or on self-hosted runners

View File

@ -38,7 +38,7 @@ name: Update AUTHORS
on:
push:
branches:
- master
- main
jobs:
updateAuthors:
runs-on: ubuntu-latest
@ -62,14 +62,14 @@ jobs:
This is a use case where a branch should be kept up to date with another by opening a pull request to update it. The pull request should then be updated with new changes until it is merged or closed.
In this example scenario, a branch called `production` should be updated via pull request to keep it in sync with `master`. Merging the pull request is effectively promoting those changes to production.
In this example scenario, a branch called `production` should be updated via pull request to keep it in sync with `main`. Merging the pull request is effectively promoting those changes to production.
```yml
name: Create production promotion pull request
on:
push:
branches:
- master
- main
jobs:
productionPromotion:
runs-on: ubuntu-latest
@ -79,8 +79,8 @@ jobs:
ref: production
- name: Reset promotion branch
run: |
git fetch origin master:master
git reset --hard master
git fetch origin main:main
git reset --hard main
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
@ -96,7 +96,7 @@ This pattern will work well for updating any kind of static content based on the
Raises a pull request to update the `CHANGELOG.md` file based on the tagged commit of the release.
Note that [git-chglog](https://github.com/git-chglog/git-chglog/) requires some configuration files to exist in the repository before this workflow will work.
This workflow assumes the tagged release was made on a default branch called `master`.
This workflow assumes the tagged release was made on a default branch called `main`.
```yml
name: Update Changelog
@ -123,7 +123,7 @@ jobs:
title: Update Changelog
body: Update changelog to reflect release changes
branch: update-changelog
base: master
base: main
```
## Use case: Create a pull request to update X periodically
@ -174,9 +174,9 @@ The above workflow works best in combination with a build workflow triggered on
name: CI
on:
push:
branches: [master]
branches: [main]
pull_request:
branches: [master]
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
@ -325,7 +325,7 @@ jobs:
This example is designed to be run in a seperate repository from the fork repository itself.
The aim of this is to prevent committing anything to the fork's default branch would cause it to differ from the upstream.
In the following example workflow, `owner/repo` is the upstream repository and `fork-owner/repo` is the fork. It assumes the default branch of the upstream repository is called `master`.
In the following example workflow, `owner/repo` is the upstream repository and `fork-owner/repo` is the fork. It assumes the default branch of the upstream repository is called `main`.
The [Personal Access Token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) should have `repo` scope. Additionally, if the upstream makes changes to the `.github/workflows` directory, the action will be unable to push the changes to a branch and throw the error "_(refusing to allow a GitHub App to create or update workflow `.github/workflows/xxx.yml` without `workflows` permission)_". To allow these changes to be pushed to the fork, add the `workflow` scope to the PAT. Of course, allowing this comes with the risk that the workflow changes from the upstream could run and do something unexpected. Disabling GitHub Actions in the fork is highly recommended to prevent this.
@ -346,8 +346,8 @@ jobs:
- name: Reset the default branch with upstream changes
run: |
git remote add upstream https://github.com/owner/repo.git
git fetch upstream master:upstream-master
git reset --hard upstream-master
git fetch upstream main:upstream-main
git reset --hard upstream-main
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:

815
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -29,26 +29,26 @@
},
"homepage": "https://github.com/peter-evans/create-pull-request",
"dependencies": {
"@actions/core": "1.2.6",
"@actions/core": "1.2.7",
"@actions/exec": "1.0.4",
"@octokit/core": "3.3.2",
"@octokit/core": "3.4.0",
"@octokit/plugin-paginate-rest": "2.13.3",
"@octokit/plugin-rest-endpoint-methods": "5.0.0",
"@octokit/plugin-rest-endpoint-methods": "5.1.1",
"uuid": "8.3.2"
},
"devDependencies": {
"@types/jest": "26.0.22",
"@types/node": "14.14.37",
"@typescript-eslint/parser": "4.20.0",
"@vercel/ncc": "0.27.0",
"eslint": "7.23.0",
"eslint-plugin-github": "4.1.2",
"eslint-plugin-jest": "24.3.2",
"@types/jest": "26.0.23",
"@types/node": "15.0.3",
"@typescript-eslint/parser": "4.23.0",
"@vercel/ncc": "0.28.5",
"eslint": "7.26.0",
"eslint-plugin-github": "4.1.3",
"eslint-plugin-jest": "24.3.6",
"jest": "26.6.3",
"jest-circus": "26.6.3",
"js-yaml": "4.0.0",
"prettier": "2.2.1",
"ts-jest": "26.5.4",
"typescript": "4.2.3"
"js-yaml": "4.1.0",
"prettier": "2.3.0",
"ts-jest": "26.5.6",
"typescript": "4.2.4"
}
}

View File

@ -91,8 +91,7 @@ export async function createOrUpdateBranch(
base: string,
branch: string,
branchRemoteName: string,
signoff: boolean,
gpgSign: boolean
signoff: boolean
): Promise<CreateOrUpdateBranchResult> {
// Get the working base.
// When a ref, it may or may not be the actual base.
@ -125,9 +124,6 @@ export async function createOrUpdateBranch(
if (signoff) {
params.push('--signoff')
}
if (gpgSign) {
params.push('--gpg-sign')
}
await git.commit(params)
}

View File

@ -16,7 +16,6 @@ export interface Inputs {
committer: string
author: string
signoff: boolean
gpgSign: boolean
branch: string
deleteBranch: boolean
branchSuffix: string
@ -174,8 +173,7 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
inputs.base,
inputs.branch,
branchRemoteName,
inputs.signoff,
inputs.gpgSign
inputs.signoff
)
core.endGroup()
@ -197,11 +195,13 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
if (result.hasDiffWithBase) {
// Create or update the pull request
core.startGroup('Create or update the pull request')
const pull = await githubHelper.createOrUpdatePullRequest(
inputs,
baseRemote.repository,
branchRepository
)
core.endGroup()
// Set outputs
core.startGroup('Setting outputs')

View File

@ -43,6 +43,7 @@ export class GitHubHelper {
): Promise<Pull> {
// Try to create the pull request
try {
core.info(`Attempting creation of pull request`)
const {data: pull} = await this.octokit.rest.pulls.create({
...this.parseRepository(baseRepository),
title: inputs.title,
@ -71,12 +72,14 @@ export class GitHubHelper {
}
// Update the pull request that exists for this branch and base
core.info(`Fetching existing pull request`)
const {data: pulls} = await this.octokit.rest.pulls.list({
...this.parseRepository(baseRepository),
state: 'open',
head: headBranch,
base: inputs.base
})
core.info(`Attempting update of pull request`)
const {data: pull} = await this.octokit.rest.pulls.update({
...this.parseRepository(baseRepository),
pull_number: pulls[0].number,

View File

@ -12,7 +12,6 @@ async function run(): Promise<void> {
committer: core.getInput('committer'),
author: core.getInput('author'),
signoff: core.getInput('signoff') === 'true',
gpgSign: core.getInput('gpg-sign') === 'true',
branch: core.getInput('branch'),
deleteBranch: core.getInput('delete-branch') === 'true',
branchSuffix: core.getInput('branch-suffix'),