Skip to content

Commit

Permalink
Merge pull request #2301 from intuit/cleanup
Browse files Browse the repository at this point in the history
delete branch after release
  • Loading branch information
hipstersmoothie authored Feb 5, 2023
2 parents 435aeca + 48fc2fb commit 39bbc16
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions plugins/protected-branch/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,22 @@ export default class ProtectedBranchPlugin implements IPlugin {
);
}
);

auto.hooks.afterRelease.tapPromise(this.name, async () => {
if (!auto.git) {
return;
}

const sha = await auto.git.getSha();
const headBranch = `${this.options.releaseTemporaryBranchPrefix}${sha}`;

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}`,
});
});
}
}

0 comments on commit 39bbc16

Please sign in to comment.