Skip to content

Commit 3d7b3cd

Browse files
committed
feat(examples): check for resolved comments before asking for repro, and remove project tracking skip
1 parent 017c077 commit 3d7b3cd

2 files changed

Lines changed: 32 additions & 12 deletions

File tree

examples/workflows/issue-cleanup/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ 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 Projects and Parent Issues (Native)**: Identifies if an issue is already part of a GitHub Project or tracked by a parent issue (task list). If so, it removes the triage label and stops, assuming the issue is already being managed as part of a larger epic. If it has no assignees, it additionally asks the reporter if it is still needed (for feature requests) or asks them to try reproducing it with the latest build (for other issues).
10-
2. **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. For feature requests, it asks to reopen if still needed. 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.
9+
1. **Check for Parent Issues (Native)**: Identifies if an issue is tracked by a parent issue (task list). If so, it removes the triage label and stops, assuming the issue is already being managed as part of a larger epic. If it has no assignees, it additionally asks the reporter if it is still needed (for feature requests) or asks them to try reproducing it with the latest build (for other issues).
10+
2. **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 first checks if the last comment indicates the issue is resolved (e.g., "functioning properly"); if so, it closes it as completed. Otherwise, it asks the reporter to reproduce it with the latest build. For feature requests, it asks to reopen if still needed. By default, it closes the inactive issue as "not planned" 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.
1111
3. **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.
1212
4. **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.
1313
5. **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: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,14 @@ jobs:
8686
});
8787
const reporter = issue.user.login;
8888
89-
// First, check if it's tracked by a parent issue or part of a project
89+
// First, check if it's tracked by a parent issue
9090
const query = `
9191
query($owner: String!, $repo: String!, $issueNumber: Int!) {
9292
repository(owner: $owner, name: $repo) {
9393
issue(number: $issueNumber) {
9494
trackedInIssues(first: 1) {
9595
totalCount
9696
}
97-
projectItems(first: 1) {
98-
totalCount
99-
}
10097
}
10198
}
10299
}
@@ -108,10 +105,9 @@ jobs:
108105
issueNumber: issueNumber
109106
});
110107
const isTracked = result.repository.issue.trackedInIssues.totalCount > 0;
111-
const inProject = result.repository.issue.projectItems.totalCount > 0;
112108
113-
if (isTracked || inProject) {
114-
console.log(`Issue #${issueNumber} is tracked by a parent issue or project. Removing 'status/need-triage' and stopping.`);
109+
if (isTracked) {
110+
console.log(`Issue #${issueNumber} is tracked by a parent issue. Removing 'status/need-triage' and stopping.`);
115111
try {
116112
await github.rest.issues.removeLabel({
117113
owner: context.repo.owner,
@@ -135,9 +131,9 @@ jobs:
135131
if (!hasAssignees) {
136132
let commentBody = '';
137133
if (isFeatureRequest) {
138-
commentBody = `@${reporter}, this feature request is currently tracked by an epic or project but has no assignees. Could you please let us know if this is still needed?`;
134+
commentBody = `@${reporter}, this feature request is currently tracked by an epic but has no assignees. Could you please let us know if this is still needed?`;
139135
} else {
140-
commentBody = `@${reporter}, this issue is currently tracked by an epic or project but has no assignees. Could you please try reproducing it with the latest build and let us know if it still occurs?`;
136+
commentBody = `@${reporter}, this issue is currently tracked by an epic but has no assignees. Could you please try reproducing it with the latest build and let us know if it still occurs?`;
141137
}
142138
await github.rest.issues.createComment({
143139
owner: context.repo.owner,
@@ -151,7 +147,7 @@ jobs:
151147
return;
152148
}
153149
} catch (err) {
154-
console.log('Failed to fetch GraphQL data for parent issues/projects:', err.message);
150+
console.log('Failed to fetch GraphQL data for parent issues:', err.message);
155151
}
156152
157153
const { data: comments } = await github.rest.issues.listComments({
@@ -202,6 +198,30 @@ jobs:
202198
console.log(`Issue was last updated ${lastUpdateDaysAgo.toFixed(1)} days ago.`);
203199
204200
if (lastUpdateDaysAgo > 30) {
201+
// Check if the last comment says it's fixed
202+
if (comments.length > 0) {
203+
const lastCommentBody = comments[comments.length - 1].body.toLowerCase();
204+
const resolvedKeywords = ['functioning properly', 'works now', 'is fixed', 'resolved now'];
205+
if (resolvedKeywords.some(kw => lastCommentBody.includes(kw))) {
206+
console.log(`Issue appears resolved in the last comment. Closing.`);
207+
await github.rest.issues.createComment({
208+
owner: context.repo.owner,
209+
repo: context.repo.repo,
210+
issue_number: issueNumber,
211+
body: "Closing because the latest comments indicate this issue has been resolved. Feel free to reopen if the problem persists."
212+
});
213+
await github.rest.issues.update({
214+
owner: context.repo.owner,
215+
repo: context.repo.repo,
216+
issue_number: issueNumber,
217+
state: 'closed',
218+
state_reason: 'completed'
219+
});
220+
core.setOutput('is_stale', 'true');
221+
return;
222+
}
223+
}
224+
205225
console.log(`Issue has been inactive for over a month. Asking for repro.`);
206226
207227
try {

0 commit comments

Comments
 (0)