add no-verify option

This commit is contained in:
Wolf Vollprecht 2022-12-08 20:02:16 +01:00
parent d36c8e0863
commit 3ecafdd2fc
4 changed files with 20 additions and 6 deletions

View file

@ -69,6 +69,9 @@ inputs:
draft: draft:
description: 'Create a draft pull request. It is not possible to change draft status after creation except through the web interface' description: 'Create a draft pull request. It is not possible to change draft status after creation except through the web interface'
default: false default: false
no-verify:
description: 'Do not run pre-push steps when pushing'
default: false
outputs: outputs:
pull-request-number: pull-request-number:
description: 'The pull request number' description: 'The pull request number'

11
dist/index.js vendored
View file

@ -423,11 +423,15 @@ function createPullRequest(inputs) {
if (['created', 'updated'].includes(result.action)) { if (['created', 'updated'].includes(result.action)) {
// The branch was created or updated // The branch was created or updated
core.startGroup(`Pushing pull request branch to '${branchRemoteName}/${inputs.branch}'`); core.startGroup(`Pushing pull request branch to '${branchRemoteName}/${inputs.branch}'`);
yield git.push([ let push_args = [
'--force-with-lease', '--force-with-lease',
branchRemoteName, branchRemoteName,
`HEAD:refs/heads/${inputs.branch}` `HEAD:refs/heads/${inputs.branch}`
]); ];
if (inputs.no_verify) {
push_args.push('--no-verify');
}
yield git.push(push_args);
core.endGroup(); core.endGroup();
} }
// Set the base. It would have been '' if not specified as an input // Set the base. It would have been '' if not specified as an input
@ -1141,7 +1145,8 @@ function run() {
reviewers: utils.getInputAsArray('reviewers'), reviewers: utils.getInputAsArray('reviewers'),
teamReviewers: utils.getInputAsArray('team-reviewers'), teamReviewers: utils.getInputAsArray('team-reviewers'),
milestone: Number(core.getInput('milestone')), milestone: Number(core.getInput('milestone')),
draft: core.getBooleanInput('draft') draft: core.getBooleanInput('draft'),
no_verify: core.getBooleanInput('no-verify'),
}; };
core.debug(`Inputs: ${(0, util_1.inspect)(inputs)}`); core.debug(`Inputs: ${(0, util_1.inspect)(inputs)}`);
yield (0, create_pull_request_1.createPullRequest)(inputs); yield (0, create_pull_request_1.createPullRequest)(inputs);

View file

@ -30,6 +30,7 @@ export interface Inputs {
teamReviewers: string[] teamReviewers: string[]
milestone: number milestone: number
draft: boolean draft: boolean
no_verify: boolean
} }
export async function createPullRequest(inputs: Inputs): Promise<void> { export async function createPullRequest(inputs: Inputs): Promise<void> {
@ -192,11 +193,15 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
core.startGroup( core.startGroup(
`Pushing pull request branch to '${branchRemoteName}/${inputs.branch}'` `Pushing pull request branch to '${branchRemoteName}/${inputs.branch}'`
) )
await git.push([ let push_args = [
'--force-with-lease', '--force-with-lease',
branchRemoteName, branchRemoteName,
`HEAD:refs/heads/${inputs.branch}` `HEAD:refs/heads/${inputs.branch}`
]) ]
if (inputs.no_verify) {
push_args.push('--no-verify')
}
await git.push(push_args)
core.endGroup() core.endGroup()
} }

View file

@ -25,7 +25,8 @@ async function run(): Promise<void> {
reviewers: utils.getInputAsArray('reviewers'), reviewers: utils.getInputAsArray('reviewers'),
teamReviewers: utils.getInputAsArray('team-reviewers'), teamReviewers: utils.getInputAsArray('team-reviewers'),
milestone: Number(core.getInput('milestone')), milestone: Number(core.getInput('milestone')),
draft: core.getBooleanInput('draft') draft: core.getBooleanInput('draft'),
no_verify: core.getBooleanInput('no-verify'),
} }
core.debug(`Inputs: ${inspect(inputs)}`) core.debug(`Inputs: ${inspect(inputs)}`)