Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove needs-manual label from original PR #306

Merged
merged 3 commits into from
Sep 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,30 @@ export const labelClosedPR = async (
`Labeling original PRs for PR at #${pr.number}`,
);

const targetLabel = PRStatus.TARGET + targetBranch;

if (change === PRChange.CLOSE) {
const targetLabel = PRStatus.TARGET + targetBranch;
await labelUtils.removeLabel(context, pr.number, targetLabel);
}

const backportNumbers = getPRNumbersFromPRBody(pr);
for (const prNumber of backportNumbers) {
const labelToRemove = PRStatus.IN_FLIGHT + targetBranch;
const inFlightLabel = PRStatus.IN_FLIGHT + targetBranch;
await labelUtils.removeLabel(context, prNumber, inFlightLabel);

// Add merged label to the original PR. If this is an intermediary PR,
// remove target labels from the current PR.
if (change === PRChange.MERGE) {
const mergedLabel = PRStatus.MERGED + targetBranch;
const targetLabel = PRStatus.TARGET + targetBranch;
const needsManualLabel = PRStatus.NEEDS_MANUAL + targetBranch;

// Add merged label to the original PR.
await labelUtils.addLabels(context, prNumber, [mergedLabel]);

// Remove the needs-manual-backport label from the original PR.
await labelUtils.removeLabel(context, prNumber, needsManualLabel);

// Remove the target label from the intermediate PR.
await labelUtils.removeLabel(context, pr.number, targetLabel);
}

await labelUtils.removeLabel(context, prNumber, labelToRemove);
}
};

Expand Down