xuang7 commented on code in PR #9612:
URL: https://github.com/apache/texera/pull/9612#discussion_r4660995212
##########
.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:
This also removes `release/*` labels that were added by hand to non-fix PRs
(docs, licensing, CI changes), and it runs on every edit, including body edits.
It should only run when the title actually changes from a fix to a non-fix, and
only for active branches.
##########
.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:
I have not tested this, but a removal made with the default `GITHUB_TOKEN`
should not trigger an `unlabeled` event, so Backport Approvals may not rerun
and could stay red after the labels are gone. One option is to remove them with
the PAT in the Label step. The opt-out check would then need to depend on the
title at the time of removal rather than on the actor.
##########
.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:
The description says retitling to `fix(ci):` also clears the labels, but
this branch still returns `none`, so they stay.
--
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]