diff --git a/__test__/create-or-update-branch.int.test.ts b/__test__/create-or-update-branch.int.test.ts index 3773d3e..3b65052 100644 --- a/__test__/create-or-update-branch.int.test.ts +++ b/__test__/create-or-update-branch.int.test.ts @@ -194,7 +194,11 @@ describe('create-or-update-branch tests', () => { ).toBeTruthy() // Push pull request branch to remote - await git.push(['--force', 'origin', `HEAD:refs/heads/${BRANCH}`]) + await git.push([ + '--force-with-lease', + 'origin', + `HEAD:refs/heads/${BRANCH}` + ]) await afterTest(false) await beforeTest() @@ -223,7 +227,11 @@ describe('create-or-update-branch tests', () => { ).toBeTruthy() // Push pull request branch to remote - await git.push(['--force', 'origin', `HEAD:refs/heads/${BRANCH}`]) + await git.push([ + '--force-with-lease', + 'origin', + `HEAD:refs/heads/${BRANCH}` + ]) await afterTest(false) await beforeTest() @@ -255,7 +263,11 @@ describe('create-or-update-branch tests', () => { ).toBeTruthy() // Push pull request branch to remote - await git.push(['--force', 'origin', `HEAD:refs/heads/${BRANCH}`]) + await git.push([ + '--force-with-lease', + 'origin', + `HEAD:refs/heads/${BRANCH}` + ]) await afterTest(false) await beforeTest() @@ -285,7 +297,11 @@ describe('create-or-update-branch tests', () => { ).toBeTruthy() // Push pull request branch to remote - await git.push(['--force', 'origin', `HEAD:refs/heads/${BRANCH}`]) + await git.push([ + '--force-with-lease', + 'origin', + `HEAD:refs/heads/${BRANCH}` + ]) await afterTest(false) await beforeTest() @@ -329,7 +345,11 @@ describe('create-or-update-branch tests', () => { ).toBeTruthy() // Push pull request branch to remote - await git.push(['--force', 'origin', `HEAD:refs/heads/${BRANCH}`]) + await git.push([ + '--force-with-lease', + 'origin', + `HEAD:refs/heads/${BRANCH}` + ]) await afterTest(false) await beforeTest() @@ -358,7 +378,11 @@ describe('create-or-update-branch tests', () => { ).toBeTruthy() // Push pull request branch to remote - await git.push(['--force', 'origin', `HEAD:refs/heads/${BRANCH}`]) + await git.push([ + '--force-with-lease', + 'origin', + `HEAD:refs/heads/${BRANCH}` + ]) await afterTest(false) await beforeTest() @@ -398,7 +422,11 @@ describe('create-or-update-branch tests', () => { ).toBeTruthy() // Push pull request branch to remote - await git.push(['--force', 'origin', `HEAD:refs/heads/${BRANCH}`]) + await git.push([ + '--force-with-lease', + 'origin', + `HEAD:refs/heads/${BRANCH}` + ]) await afterTest(false) await beforeTest() @@ -437,7 +465,11 @@ describe('create-or-update-branch tests', () => { ).toBeTruthy() // Push pull request branch to remote - await git.push(['--force', 'origin', `HEAD:refs/heads/${BRANCH}`]) + await git.push([ + '--force-with-lease', + 'origin', + `HEAD:refs/heads/${BRANCH}` + ]) await afterTest(false) await beforeTest() @@ -480,7 +512,11 @@ describe('create-or-update-branch tests', () => { ).toBeTruthy() // Push pull request branch to remote - await git.push(['--force', 'origin', `HEAD:refs/heads/${BRANCH}`]) + await git.push([ + '--force-with-lease', + 'origin', + `HEAD:refs/heads/${BRANCH}` + ]) await afterTest(false) await beforeTest() @@ -536,7 +572,11 @@ describe('create-or-update-branch tests', () => { ).toBeTruthy() // Push pull request branch to remote - await git.push(['--force', 'origin', `HEAD:refs/heads/${BRANCH}`]) + await git.push([ + '--force-with-lease', + 'origin', + `HEAD:refs/heads/${BRANCH}` + ]) await afterTest(false) await beforeTest() @@ -576,7 +616,11 @@ describe('create-or-update-branch tests', () => { ).toBeTruthy() // Push pull request branch to remote - await git.push(['--force', 'origin', `HEAD:refs/heads/${BRANCH}`]) + await git.push([ + '--force-with-lease', + 'origin', + `HEAD:refs/heads/${BRANCH}` + ]) await afterTest(false) await beforeTest() @@ -619,7 +663,11 @@ describe('create-or-update-branch tests', () => { ).toBeTruthy() // Push pull request branch to remote - await git.push(['--force', 'origin', `HEAD:refs/heads/${BRANCH}`]) + await git.push([ + '--force-with-lease', + 'origin', + `HEAD:refs/heads/${BRANCH}` + ]) await afterTest(false) await beforeTest() @@ -660,7 +708,11 @@ describe('create-or-update-branch tests', () => { ).toBeTruthy() // Push pull request branch to remote - await git.push(['--force', 'origin', `HEAD:refs/heads/${BRANCH}`]) + await git.push([ + '--force-with-lease', + 'origin', + `HEAD:refs/heads/${BRANCH}` + ]) await afterTest(false) await beforeTest() @@ -715,7 +767,11 @@ describe('create-or-update-branch tests', () => { ).toBeTruthy() // Push pull request branch to remote - await git.push(['--force', 'origin', `HEAD:refs/heads/${BRANCH}`]) + await git.push([ + '--force-with-lease', + 'origin', + `HEAD:refs/heads/${BRANCH}` + ]) await afterTest(false) await beforeTest() @@ -757,7 +813,11 @@ describe('create-or-update-branch tests', () => { ).toBeTruthy() // Push pull request branch to remote - await git.push(['--force', 'origin', `HEAD:refs/heads/${BRANCH}`]) + await git.push([ + '--force-with-lease', + 'origin', + `HEAD:refs/heads/${BRANCH}` + ]) await afterTest(false) await beforeTest() @@ -808,7 +868,11 @@ describe('create-or-update-branch tests', () => { ).toBeTruthy() // Push pull request branch to remote - await git.push(['--force', 'origin', `HEAD:refs/heads/${BRANCH}`]) + await git.push([ + '--force-with-lease', + 'origin', + `HEAD:refs/heads/${BRANCH}` + ]) await afterTest(false) await beforeTest() @@ -858,7 +922,11 @@ describe('create-or-update-branch tests', () => { ).toBeTruthy() // Push pull request branch to remote - await git.push(['--force', 'origin', `HEAD:refs/heads/${BRANCH}`]) + await git.push([ + '--force-with-lease', + 'origin', + `HEAD:refs/heads/${BRANCH}` + ]) await afterTest(false) await beforeTest() @@ -912,7 +980,11 @@ describe('create-or-update-branch tests', () => { ).toBeTruthy() // Push pull request branch to remote - await git.push(['--force', 'origin', `HEAD:refs/heads/${BRANCH}`]) + await git.push([ + '--force-with-lease', + 'origin', + `HEAD:refs/heads/${BRANCH}` + ]) await afterTest(false) await beforeTest() diff --git a/dist/index.js b/dist/index.js index 1417472..53fb1e7 100644 --- a/dist/index.js +++ b/dist/index.js @@ -10604,7 +10604,11 @@ function createPullRequest(inputs) { if (['created', 'updated'].includes(result.action)) { // The branch was created or updated core.startGroup(`Pushing pull request branch to 'origin/${inputs.branch}'`); - yield git.push(['--force', 'origin', `HEAD:refs/heads/${inputs.branch}`]); + yield git.push([ + '--force-with-lease', + 'origin', + `HEAD:refs/heads/${inputs.branch}` + ]); core.endGroup(); // Set the base. It would have been '' if not specified as an input inputs.base = result.base; diff --git a/src/create-pull-request.ts b/src/create-pull-request.ts index ea3f349..41e921d 100644 --- a/src/create-pull-request.ts +++ b/src/create-pull-request.ts @@ -185,7 +185,11 @@ export async function createPullRequest(inputs: Inputs): Promise { core.startGroup( `Pushing pull request branch to 'origin/${inputs.branch}'` ) - await git.push(['--force', 'origin', `HEAD:refs/heads/${inputs.branch}`]) + await git.push([ + '--force-with-lease', + 'origin', + `HEAD:refs/heads/${inputs.branch}` + ]) core.endGroup() // Set the base. It would have been '' if not specified as an input