mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-25 17:44:36 +00:00
1cb84a79df
## Problem The issue-lifecycle stale rule checked labels with case-sensitive `Array.includes()`, so an issue carrying the `Stale` label (created by the `actions/stale` PR bot) was never recognized as stale. `hasStaleLabel` stayed `false` and the bot re-posted the 7-day warning on **every** daily cron run. Example: [#3441](https://github.com/openfrontio/OpenFrontIO/issues/3441) got the same "hasn't had activity in 7 days" comment ~16 days in a row. ## Fix GitHub label names are case-insensitive (you can't have both `Stale` and `stale`), so the gate should be too. Adds a `hasLabel()` helper in `github.ts` and routes all label checks through it (`STALE`, `KEEP_OPEN`, `APPROVED`, `NOT_APPROVED`). Now an issue gets one stale warning when marked, then silence until the 14-day close. ## Note The Dependabot PR-exemption change (`pr-stale.yml`) is being applied separately — the CI token here lacks `workflow` scope to push workflow-file changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
27 lines
820 B
TypeScript
27 lines
820 B
TypeScript
import { LABELS } from "../config";
|
|
import { type Action, hasLabel, type Issue } from "../github";
|
|
|
|
export function syncApprovalLabel(issue: Issue): Action[] {
|
|
const hasApproved = hasLabel(issue, LABELS.APPROVED);
|
|
const hasNotApproved = hasLabel(issue, LABELS.NOT_APPROVED);
|
|
const milestoned = issue.milestone !== null;
|
|
const actions: Action[] = [];
|
|
|
|
if (milestoned) {
|
|
if (!hasApproved) {
|
|
actions.push({ type: "add_label", label: LABELS.APPROVED });
|
|
}
|
|
if (hasNotApproved) {
|
|
actions.push({ type: "remove_label", label: LABELS.NOT_APPROVED });
|
|
}
|
|
} else {
|
|
if (!hasNotApproved) {
|
|
actions.push({ type: "add_label", label: LABELS.NOT_APPROVED });
|
|
}
|
|
if (hasApproved) {
|
|
actions.push({ type: "remove_label", label: LABELS.APPROVED });
|
|
}
|
|
}
|
|
return actions;
|
|
}
|