Skip to content

Commit

Permalink
fix: only delete temp branch in the end
Browse files Browse the repository at this point in the history
  • Loading branch information
ericksprengel committed Jan 13, 2023
1 parent c382772 commit dd534cc
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,20 @@ async function run() {

const pullRequests = await getPrs()


let lastMergeCommitSha
for (let pull of pullRequests) {
try {
try {
let lastMergeCommitSha
for (let pull of pullRequests) {
console.log(`Merging PR ${pull.number}`)
const { data } = await mergeBranchs(pull.head.ref)

console.log(`Successful merge PR ${pull.number}`);

lastMergeCommitSha = data.sha
} finally {
await deleteBranch(workBranchName)
}
await recreateDeployBranch(lastMergeCommitSha)
} finally {
await deleteBranch(workBranchName)
}

await recreateDeployBranch(lastMergeCommitSha)

await deleteBranch(workBranchName)
}

run()

0 comments on commit dd534cc

Please sign in to comment.