Skip to content

Commit 17b3714

Browse files
authored
fix(automation): evaluate staleness before checking protected labels (#22561)
1 parent 5ddb517 commit 17b3714

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

.github/workflows/gemini-scheduled-stale-pr-closer.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,7 @@ jobs:
200200
201201
// 4. Staleness Check (Scheduled only)
202202
if (pr.state === 'open' && context.eventName !== 'pull_request') {
203-
// PRs with help wanted/maintainer only labels are still checked for staleness
204-
// but usually given more leeway. Here we stick to 30 days of no maintainer activity.
205-
203+
// Skip PRs that were created less than 30 days ago - they cannot be stale yet
206204
const prCreatedAt = new Date(pr.created_at);
207205
if (prCreatedAt > thirtyDaysAgo) continue;
208206
@@ -229,7 +227,14 @@ jobs:
229227
} catch (e) {}
230228
231229
if (lastActivity < thirtyDaysAgo) {
232-
core.info(`PR #${pr.number} is stale.`);
230+
const labels = pr.labels.map(l => l.name.toLowerCase());
231+
const isProtected = labels.includes('help wanted') || labels.includes('🔒 maintainer only');
232+
if (isProtected) {
233+
core.info(`PR #${pr.number} is stale but has a protected label. Skipping closure.`);
234+
continue;
235+
}
236+
237+
core.info(`PR #${pr.number} is stale (no maintainer activity for 30+ days). Closing.`);
233238
if (!dryRun) {
234239
await github.rest.issues.createComment({
235240
owner: context.repo.owner,

0 commit comments

Comments
 (0)