Merge pull request #804 from peter-evans/gpg-sign-fix

fix: remove unnecessary gpg-sign input
This commit is contained in:
Peter Evans 2021-05-10 09:19:01 +09:00 committed by GitHub
commit d9d6fd980e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 7 additions and 75 deletions

View file

@ -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 <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. | |

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'

8
dist/index.js vendored
View file

@ -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'),

View file

@ -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

@ -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()

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'),