From 8bb8511e4d2ba1cd72b6398d630504c7d268e80e Mon Sep 17 00:00:00 2001 From: Peter Evans <18365890+peter-evans@users.noreply.github.com> Date: Mon, 10 May 2021 09:01:53 +0900 Subject: [PATCH] fix: remove unnecessary gpg-sign input --- README.md | 1 - __test__/create-or-update-branch.int.test.ts | 56 +------------------- action.yml | 3 -- dist/index.js | 8 +-- docs/concepts-guidelines.md | 3 +- src/create-or-update-branch.ts | 6 +-- src/create-pull-request.ts | 4 +- src/main.ts | 1 - 8 files changed, 7 insertions(+), 75 deletions(-) diff --git a/README.md b/README.md index 8580e931fb..e2406cd0eb 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,6 @@ All inputs are **optional**. If not set, sensible defaults will be used. | `committer` | The committer name and email address in the format `Display Name `. Defaults to the GitHub Actions bot user. | `GitHub ` | | `author` | The author name and email address in the format `Display Name `. 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. | | diff --git a/__test__/create-or-update-branch.int.test.ts b/__test__/create-or-update-branch.int.test.ts index 514e63f6e1..523bbe9d62 100644 --- a/__test__/create-or-update-branch.int.test.ts +++ b/__test__/create-or-update-branch.int.test.ts @@ -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') diff --git a/action.yml b/action.yml index 0381724eb2..c169c32062 100644 --- a/action.yml +++ b/action.yml @@ -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' diff --git a/dist/index.js b/dist/index.js index 8842ea4d50..b1d6be6aad 100644 --- a/dist/index.js +++ b/dist/index.js @@ -99,7 +99,7 @@ function splitLines(multilineString) { .map(s => s.trim()) .filter(x => x !== ''); } -function createOrUpdateBranch(git, commitMessage, base, branch, branchRemoteName, signoff, gpgSign) { +function createOrUpdateBranch(git, commitMessage, base, branch, branchRemoteName, signoff) { return __awaiter(this, void 0, void 0, function* () { // Get the working base. // When a ref, it may or may not be the actual base. @@ -129,9 +129,6 @@ function createOrUpdateBranch(git, commitMessage, base, branch, branchRemoteName if (signoff) { params.push('--signoff'); } - if (gpgSign) { - params.push('--gpg-sign'); - } yield git.commit(params); } // Perform fetch and reset the working base @@ -378,7 +375,7 @@ function createPullRequest(inputs) { core.endGroup(); // Create or update the pull request branch core.startGroup('Create or update the pull request branch'); - const result = yield create_or_update_branch_1.createOrUpdateBranch(git, inputs.commitMessage, inputs.base, inputs.branch, branchRemoteName, inputs.signoff, inputs.gpgSign); + const result = yield create_or_update_branch_1.createOrUpdateBranch(git, inputs.commitMessage, inputs.base, inputs.branch, branchRemoteName, inputs.signoff); core.endGroup(); if (['created', 'updated'].includes(result.action)) { // The branch was created or updated @@ -1073,7 +1070,6 @@ function run() { 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'), diff --git a/docs/concepts-guidelines.md b/docs/concepts-guidelines.md index 2bee1aff41..fc79382a56 100644 --- a/docs/concepts-guidelines.md +++ b/docs/concepts-guidelines.md @@ -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 - gpg-sign: true ``` ### Running in a container or on self-hosted runners diff --git a/src/create-or-update-branch.ts b/src/create-or-update-branch.ts index b58176915c..2767014d01 100644 --- a/src/create-or-update-branch.ts +++ b/src/create-or-update-branch.ts @@ -91,8 +91,7 @@ export async function createOrUpdateBranch( base: string, branch: string, branchRemoteName: string, - signoff: boolean, - gpgSign: boolean + signoff: boolean ): Promise { // 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) } diff --git a/src/create-pull-request.ts b/src/create-pull-request.ts index 981a20bd55..dc52b19e92 100644 --- a/src/create-pull-request.ts +++ b/src/create-pull-request.ts @@ -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 { inputs.base, inputs.branch, branchRemoteName, - inputs.signoff, - inputs.gpgSign + inputs.signoff ) core.endGroup() diff --git a/src/main.ts b/src/main.ts index 67d073c0cf..157659bb31 100644 --- a/src/main.ts +++ b/src/main.ts @@ -12,7 +12,6 @@ async function run(): Promise { 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'),