Ma77Ball commented on code in PR #9612:
URL: https://github.com/apache/texera/pull/9612#discussion_r4663629460
##########
.github/workflows/backport-auto-label.yml:
##########
@@ -114,13 +121,27 @@ jobs:
return { mode: "none" };
}
+ const currentLabels = new Set((pr.labels || []).map((l) =>
l.name));
+ const configuredBranches = entries.map((e) => e.branch);
+
+ // When a PR is no longer a fix, the release/* labels this
workflow
+ // added are stale. Remove the configured ones still present so
the
+ // author does not have to; the bot-authored report step does the
+ // removal (as github-actions[bot]) so it is not remembered as an
+ // opt-out and a later re-fix re-adds the labels.
+ function cleanupOrNone() {
+ const toRemove = configuredBranches.filter((b) =>
currentLabels.has(b));
+ if (toRemove.length === 0) return { mode: "none" };
+ return { mode: "cleanup", toRemove };
+ }
Review Comment:
Cleanup now runs only on an `edited` event whose title actually changed away
from a backportable fix (via `changes.title.from`) and only removes the
actively-supported `release/*` labels, so a body-only edit and a label
hand-added to a PR that was never a fix are both left untouched.
##########
.github/workflows/backport-auto-label.yml:
##########
@@ -130,7 +151,7 @@ jobs:
.map((s) => s.trim().toLowerCase())
.filter(Boolean);
if (scopes.includes("ci")) {
- core.info(`PR #${pr.number} is fix(ci) — CI-only, never
backported; skipping.`);
+ core.info(`PR #${pr.number} is fix(ci), CI-only and never
backported; skipping.`);
return { mode: "none" };
Review Comment:
Folded the `fix(ci):` case into the same `isBackportableFix` test as non-fix
titles, so retitling a labeled PR to `fix(ci):` now clears its release labels
instead of returning `none`.
##########
.github/workflows/backport-auto-label.yml:
##########
@@ -378,6 +406,35 @@ jobs:
}
}
+ // The PR is no longer a backportable fix: remove the stale release
+ // labels as github-actions[bot] (so the removal is not remembered
as
+ // an opt-out) and update the report to say they can come back.
+ if (result.mode === "cleanup") {
+ for (const label of result.toRemove || []) {
+ try {
+ await github.rest.issues.removeLabel({
+ owner, repo, issue_number: pr.number, name: label,
+ });
Review Comment:
Moved the label removal into the PAT-authored Label step so the `unlabeled`
event reruns Backport Approvals, and switched the opt-out test from the
removing actor to the PR title at the time of removal (reconstructed from the
timeline's `renamed` events), so the workflow's own cleanup is not mistaken for
a decline.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]