Skip to content

Commit

Permalink
fix: prevent accidental branch backport duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Aug 19, 2024
1 parent ea9fff7 commit 9b8a49c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,13 +543,14 @@ const probotHandler: ApplicationFunction = async (robot, { getRouter }) => {
name: 'backport to branch',
command: /^run backport-to (([^,]*)(, ?([^,]*))*)/,
execute: async (targetBranches: string) => {
const branches = targetBranches.split(',').map((b) => b.trim());
const branches = new Set(
targetBranches.split(',').map((b) => b.trim()),
);
for (const branch of branches) {
robot.log(
`Initiating backport to \`${branch}\` from 'backport-to' comment`,
);

if (!branch.trim()) continue;
const pr = (
await context.octokit.pulls.get(
context.repo({ pull_number: issue.number }),
Expand Down

0 comments on commit 9b8a49c

Please sign in to comment.