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:
description: 'Create a draft pull request. It is not possible to change draft status after creation except through the web interface'
default: false
no-verify:
description: 'Do not run pre-push steps when pushing'
default: false
outputs:
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)) {
// The branch was created or updated
core.startGroup(`Pushing pull request branch to '${branchRemoteName}/${inputs.branch}'`);
yield git.push([
let push_args = [
'--force-with-lease',
branchRemoteName,
`HEAD:refs/heads/${inputs.branch}`
]);
];
if (inputs.no_verify) {
push_args.push('--no-verify');
}
yield git.push(push_args);
core.endGroup();
}
// Set the base. It would have been '' if not specified as an input
@ -1141,7 +1145,8 @@ function run() {
reviewers: utils.getInputAsArray('reviewers'),
teamReviewers: utils.getInputAsArray('team-reviewers'),
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)}`);
yield (0, create_pull_request_1.createPullRequest)(inputs);

View file

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

View file

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