diff --git a/dist/index.js b/dist/index.js index 57130a6267..b410e361d3 100644 --- a/dist/index.js +++ b/dist/index.js @@ -164,20 +164,12 @@ function createOrUpdateBranch(git, commitMessage, base, branch, branchRemoteName } // Stash any uncommitted tracked and untracked changes const stashed = yield git.stashPush(['--include-untracked']); - // Perform fetch and reset the working base + // Reset the working base // Commits made during the workflow will be removed if (workingBaseType == WorkingBaseType.Branch) { core.info(`Resetting working base branch '${workingBase}'`); - if (branchRemoteName == 'fork') { - // If pushing to a fork we must fetch with 'unshallow' to avoid the following error on git push - // ! [remote rejected] HEAD -> tests/push-branch-to-fork (shallow update not allowed) - yield git.fetch([`${workingBase}:${workingBase}`], baseRemote, ['--force'], true); - } - else { - // If the remote is 'origin' we can git reset - yield git.checkout(workingBase); - yield git.exec(['reset', '--hard', `${baseRemote}/${workingBase}`]); - } + yield git.checkout(workingBase); + yield git.exec(['reset', '--hard', `${baseRemote}/${workingBase}`]); } // If the working base is not the base, rebase the temp branch commits // This will also be true if the working base type is a commit diff --git a/package-lock.json b/package-lock.json index 908d852b1a..cff2965b59 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ }, "devDependencies": { "@types/jest": "^29.5.12", - "@types/node": "^18.19.23", + "@types/node": "^18.19.31", "@typescript-eslint/parser": "^5.62.0", "@vercel/ncc": "^0.38.1", "eslint": "^8.57.0", @@ -1656,9 +1656,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.19.23", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.23.tgz", - "integrity": "sha512-wtE3d0OUfNKtZYAqZb8HAWGxxXsImJcPUAgZNw+dWFxO6s5tIwIjyKnY76tsTatsNCLJPkVYwUpq15D38ng9Aw==", + "version": "18.19.31", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.31.tgz", + "integrity": "sha512-ArgCD39YpyyrtFKIqMDvjz79jto5fcI/SVUs2HwB+f0dAzq68yqOdyaSivLiLugSziTpNXLQrVb7RZFmdZzbhA==", "dev": true, "dependencies": { "undici-types": "~5.26.4" diff --git a/package.json b/package.json index 74c16db676..960614df4a 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ }, "devDependencies": { "@types/jest": "^29.5.12", - "@types/node": "^18.19.23", + "@types/node": "^18.19.31", "@typescript-eslint/parser": "^5.62.0", "@vercel/ncc": "^0.38.1", "eslint": "^8.57.0", diff --git a/src/create-or-update-branch.ts b/src/create-or-update-branch.ts index 000dc513d6..4d489dd35d 100644 --- a/src/create-or-update-branch.ts +++ b/src/create-or-update-branch.ts @@ -173,24 +173,12 @@ export async function createOrUpdateBranch( // Stash any uncommitted tracked and untracked changes const stashed = await git.stashPush(['--include-untracked']) - // Perform fetch and reset the working base + // Reset the working base // Commits made during the workflow will be removed if (workingBaseType == WorkingBaseType.Branch) { core.info(`Resetting working base branch '${workingBase}'`) - if (branchRemoteName == 'fork') { - // If pushing to a fork we must fetch with 'unshallow' to avoid the following error on git push - // ! [remote rejected] HEAD -> tests/push-branch-to-fork (shallow update not allowed) - await git.fetch( - [`${workingBase}:${workingBase}`], - baseRemote, - ['--force'], - true - ) - } else { - // If the remote is 'origin' we can git reset - await git.checkout(workingBase) - await git.exec(['reset', '--hard', `${baseRemote}/${workingBase}`]) - } + await git.checkout(workingBase) + await git.exec(['reset', '--hard', `${baseRemote}/${workingBase}`]) } // If the working base is not the base, rebase the temp branch commits