Skip to content

Commit a5f1f4e

Browse files
committed
feat(examples): exempt P0/P1 issues from auto-closing and tag assignees
1 parent fc993bb commit a5f1f4e

2 files changed

Lines changed: 37 additions & 9 deletions

File tree

examples/workflows/issue-cleanup/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This document describes a workflow to batch-process and clean up older open issu
66

77
The Issue Cleanup workflow is designed to automate the triage of stale issues by using the Gemini CLI to:
88

9-
1. **Check for Staleness and Age (Native)**: Identifies if an issue has been waiting for reporter feedback for over 7 days, closing it if so. If the issue is not stale but hasn't been updated in over a month, it closes the issue while asking the reporter to try reproducing it with the latest build. This is handled via a native GitHub Action script to save AI resources.
9+
1. **Check for Staleness and Age (Native)**: Identifies if an issue has been waiting for reporter feedback for over 7 days, closing it if so. If the issue is not stale but hasn't been updated in over a month, it asks the reporter to reproduce it with the latest build. By default, it closes the inactive issue and tags any assignees to reopen it. However, if the issue is a high-priority (`p0` or `p1`), it leaves the issue open. This logic runs natively to save AI resources.
1010
2. **Check for Vagueness (AI)**: If an issue is not stale or old but lacks sufficient information (e.g., reproduction steps), the agent asks the reporter for specific details and stops.
1111
3. **Check Code Validity (AI)**: Determines if an issue is still relevant against the current codebase. The agent may attempt to write and execute a minimal reproduction script to verify if a bug has been resolved, or manually inspect the code. If verified as fixed, it will close the issue with an explanation.
1212
4. **Find Duplicates (AI)**: Checks if the issue has a more recent duplicate. If a duplicate exists, it closes the issue and links to the duplicate.

examples/workflows/issue-cleanup/gemini-issue-cleanup.yml

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,19 +158,47 @@ jobs:
158158
console.log('Failed to add needs-info label:', e.message);
159159
}
160160
161-
await github.rest.issues.createComment({
162-
owner: context.repo.owner,
163-
repo: context.repo.repo,
164-
issue_number: issueNumber,
165-
body: `@${reporter}, this issue hasn't been updated in over a month. Could you please try reproducing it with the latest build? If it still occurs, please provide detailed reproduction steps and feel free to reopen this issue.`
161+
const assignees = issue.assignees.map(a => a.login);
162+
const hasAssignees = assignees.length > 0;
163+
const assigneeMentions = hasAssignees ? assignees.map(a => `@${a}`).join(' ') : '';
164+
165+
const isHighPriority = issue.labels.some(l => {
166+
const name = typeof l === 'string' ? l : l.name;
167+
const lowerName = name.toLowerCase();
168+
return lowerName === 'priority/p0' || lowerName === 'priority/p1' || lowerName === 'p0' || lowerName === 'p1';
166169
});
167-
await github.rest.issues.update({
170+
171+
let commentBody = `@${reporter}, this issue hasn't been updated in over a month. Could you please try reproducing it with the latest build? If it still occurs, please provide detailed reproduction steps.`;
172+
173+
if (!isHighPriority) {
174+
if (hasAssignees) {
175+
commentBody += `\n\n${assigneeMentions}, please reopen if you are actively working on this.`;
176+
} else {
177+
commentBody += ` Feel free to reopen this issue.`;
178+
}
179+
} else {
180+
if (hasAssignees) {
181+
commentBody += `\n\n${assigneeMentions}, checking in on this high priority issue.`;
182+
}
183+
}
184+
185+
await github.rest.issues.createComment({
168186
owner: context.repo.owner,
169187
repo: context.repo.repo,
170188
issue_number: issueNumber,
171-
state: 'closed',
172-
state_reason: 'not_planned'
189+
body: commentBody
173190
});
191+
192+
if (!isHighPriority) {
193+
await github.rest.issues.update({
194+
owner: context.repo.owner,
195+
repo: context.repo.repo,
196+
issue_number: issueNumber,
197+
state: 'closed',
198+
state_reason: 'not_planned'
199+
});
200+
}
201+
174202
core.setOutput('is_stale', 'true');
175203
return;
176204
}

0 commit comments

Comments
 (0)