Skip to content

Commit

Permalink
delete branch after release
Browse files Browse the repository at this point in the history
  • Loading branch information
hipstersmoothie committed Feb 5, 2023
1 parent 955bc50 commit 48fc2fb
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 48fc2fb

Please sign in to comment.