mirror of
https://forgejo.stefka.eu/jiriks74/create-pull-request.git
synced 2025-01-18 16:01:06 +01:00
feat: add option to choose between force and force-with-lease
This commit is contained in:
parent
f094b77505
commit
e4c00137fe
4 changed files with 10 additions and 4 deletions
|
@ -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
|
||||
force:
|
||||
description: 'Force push the changes even if the current branch is referenced by others.'
|
||||
default: false
|
||||
outputs:
|
||||
pull-request-number:
|
||||
description: 'The pull request number'
|
||||
|
|
5
dist/index.js
vendored
5
dist/index.js
vendored
|
@ -393,7 +393,7 @@ function createPullRequest(inputs) {
|
|||
// The branch was created or updated
|
||||
core.startGroup(`Pushing pull request branch to '${branchRemoteName}/${inputs.branch}'`);
|
||||
yield git.push([
|
||||
'--force-with-lease',
|
||||
inputs.force ? '--force' : '--force-with-lease',
|
||||
branchRemoteName,
|
||||
`HEAD:refs/heads/${inputs.branch}`
|
||||
]);
|
||||
|
@ -1109,7 +1109,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'),
|
||||
force: core.getBooleanInput('force')
|
||||
};
|
||||
core.debug(`Inputs: ${(0, util_1.inspect)(inputs)}`);
|
||||
yield (0, create_pull_request_1.createPullRequest)(inputs);
|
||||
|
|
|
@ -30,6 +30,7 @@ export interface Inputs {
|
|||
teamReviewers: string[]
|
||||
milestone: number
|
||||
draft: boolean
|
||||
force: boolean
|
||||
}
|
||||
|
||||
export async function createPullRequest(inputs: Inputs): Promise<void> {
|
||||
|
@ -185,7 +186,7 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
|
|||
`Pushing pull request branch to '${branchRemoteName}/${inputs.branch}'`
|
||||
)
|
||||
await git.push([
|
||||
'--force-with-lease',
|
||||
inputs.force ? '--force' : '--force-with-lease',
|
||||
branchRemoteName,
|
||||
`HEAD:refs/heads/${inputs.branch}`
|
||||
])
|
||||
|
|
|
@ -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'),
|
||||
force: core.getBooleanInput('force')
|
||||
}
|
||||
core.debug(`Inputs: ${inspect(inputs)}`)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue