Skip to content

Commit

Permalink
feat(protected-branch): silently ignore ref not found when deleting
Browse files Browse the repository at this point in the history
  • Loading branch information
jBouyoud committed Feb 9, 2023
1 parent 5111bd4 commit 275b12c
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions plugins/protected-branch/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,18 @@ export default class ProtectedBranchPlugin implements IPlugin {

auto.logger.log.info("Delete release branch 🗑️ ");

await auto.git.github.git.deleteRef({
owner: auto.git.options.owner,
repo: auto.git.options.repo,
ref: `heads/${headBranch}`,
});
try {
await auto.git.github.git.deleteRef({
owner: auto.git.options.owner,
repo: auto.git.options.repo,
ref: `heads/${headBranch}`,
});
} catch (e) {
// Silently ignore reference not found error since the ref might already be deleted
if (!e || e.status !== 422 || e.message !== "Reference does not exist") {
throw e;
}
}
});
}
}

0 comments on commit 275b12c

Please sign in to comment.