Skip to content

Commit e10c208

Browse files
authored
feat(triage): improve automated issue triage workflows (#2778)
1 parent 84355bb commit e10c208

File tree

2 files changed

+55
-33
lines changed

2 files changed

+55
-33
lines changed

.github/workflows/gemini-automated-issue-triage.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,10 @@ jobs:
2323
app-id: ${{ secrets.APP_ID }}
2424
private-key: ${{ secrets.PRIVATE_KEY }}
2525

26-
- name: Checkout repository
27-
uses: actions/checkout@v4
28-
with:
29-
token: ${{ steps.generate_token.outputs.token }}
30-
3126
- name: Run Gemini Issue Triage
32-
uses: google-gemini/gemini-cli-action@111dadaecabd309baba60f56f2b520c52c0f9a47
27+
uses: google-gemini/gemini-cli-action@41c0f1b3cbd1a0b284251bd1aac034edd07a3a2f
3328
env:
3429
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
35-
ISSUE_TITLE: ${{ github.event.issue.title }}
36-
ISSUE_BODY: ${{ github.event.issue.body }}
37-
ISSUE_NUMBER: ${{ github.event.issue.number }}
38-
REPOSITORY: ${{ github.repository }}
3930
with:
4031
version: 0.1.8-rc.0
4132
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
@@ -48,16 +39,23 @@ jobs:
4839
"run_shell_command(gh label list)",
4940
"run_shell_command(gh issue edit)",
5041
"run_shell_command(gh issue list)"
51-
],
42+
]
5243
}
5344
prompt: |
5445
You are an issue triage assistant. Analyze the current GitHub issue and apply the most appropriate existing labels.
5546
5647
Steps:
57-
1. Run: `gh label list --limit 100` to get all available labels.
48+
1. Run: `gh label list --repo ${{ github.repository }} --limit 100` to get all available labels.
5849
2. Review the issue title and body provided in the environment variables.
5950
3. Select the most relevant labels from the existing labels, focusing on kind/*, area/*, and priority/*.
60-
4. Apply the selected labels to this issue using: `gh issue edit ISSUE_NUMBER --add-label "label1,label2"`
51+
4. Apply the selected labels to this issue using: `gh issue edit ${{ github.event.issue.number }} --repo ${{ github.repository }} --add-label "label1,label2"`
52+
5. If the issue has a "status/need-triage" label, remove it after applying the appropriate labels: `gh issue edit ${{ github.event.issue.number }} --repo ${{ github.repository }} --remove-label "status/need-triage"`
53+
54+
Guidelines:
55+
- Only use labels that already exist in the repository.
56+
- Do not add comments or modify the issue content.
57+
- Triage only the current issue.
58+
- Assign all applicable kind/*, area/*, and priority/* labels based on the issue content.
6159
6260
Guidelines:
6361
- Only use labels that already exist in the repository.

.github/workflows/gemini-scheduled-issue-triage.yml

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,33 @@ jobs:
2121
app-id: ${{ secrets.APP_ID }}
2222
private-key: ${{ secrets.PRIVATE_KEY }}
2323

24-
- name: Checkout repository
25-
uses: actions/checkout@v4
26-
with:
27-
token: ${{ steps.generate_token.outputs.token }}
28-
2924
- name: Find untriaged issues
3025
id: find_issues
3126
env:
3227
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
3328
run: |
29+
echo "🔍 Finding issues without labels..."
3430
NO_LABEL_ISSUES=$(gh issue list --repo ${{ github.repository }} --search "is:open is:issue no:label" --json number,title,body)
35-
NEEDS_TRIAGE_ISSUES=$(gh issue list --repo ${{ github.repository }} --search "is:open is:issue label:\"status/needs-triage\"" --json number,title,body)
36-
ISSUES=$(echo "$NO_LABEL_ISSUES" "$NEEDS_TRIAGE_ISSUES" | jq -c -s 'add | unique_by(.number)')
31+
32+
echo "🏷️ Finding issues that need triage..."
33+
NEED_TRIAGE_ISSUES=$(gh issue list --repo ${{ github.repository }} --search "is:open is:issue label:\"status/need-triage\"" --json number,title,body)
34+
35+
echo "🔄 Merging and deduplicating issues..."
36+
ISSUES=$(echo "$NO_LABEL_ISSUES" "$NEED_TRIAGE_ISSUES" | jq -c -s 'add | unique_by(.number)')
37+
38+
echo "📝 Setting output for GitHub Actions..."
3739
echo "issues_to_triage=$ISSUES" >> "$GITHUB_OUTPUT"
3840
41+
echo "💾 Writing issues to temporary file for Gemini CLI..."
42+
echo "$ISSUES" > /tmp/issues_to_triage.json
43+
44+
echo "✅ Found $(echo "$ISSUES" | jq 'length') issues to triage! 🎯"
45+
3946
- name: Run Gemini Issue Triage
4047
if: steps.find_issues.outputs.issues_to_triage != '[]'
41-
uses: google-gemini/gemini-cli-action@111dadaecabd309baba60f56f2b520c52c0f9a47
48+
uses: google-gemini/gemini-cli-action@41c0f1b3cbd1a0b284251bd1aac034edd07a3a2f
4249
env:
4350
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
44-
ISSUES_TO_TRIAGE: ${{ steps.find_issues.outputs.issues_to_triage }}
45-
REPOSITORY: ${{ github.repository }}
4651
with:
4752
version: 0.1.8-rc.0
4853
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
@@ -54,19 +59,38 @@ jobs:
5459
"coreTools": [
5560
"run_shell_command(gh label list)",
5661
"run_shell_command(gh issue edit)",
57-
"run_shell_command(gh issue list)"
58-
],
62+
"run_shell_command(gh issue list)",
63+
"run_shell_command(cat /tmp/issues_to_triage.json)"
64+
]
5965
}
6066
prompt: |
61-
You are an issue triage assistant. Analyze issues and apply appropriate labels.
67+
You are an issue triage assistant. Analyze issues and apply appropriate labels ONE AT A TIME.
68+
69+
Repository: ${{ github.repository }}
6270
6371
Steps:
64-
1. Run: `gh label list --limit 100`
65-
2. Check environment variable: $ISSUES_TO_TRIAGE (JSON array of issues)
66-
3. For each issue, apply labels: `gh issue edit ISSUE_NUMBER --add-label "label1,label2"`
72+
1. Run: `gh label list --repo ${{ github.repository }} --limit 100` to see available labels
73+
2. Run: `cat /tmp/issues_to_triage.json` to get the issues that need triaging
74+
3. Parse the JSON array from step 2 and for EACH INDIVIDUAL issue, apply appropriate labels using separate commands:
75+
- `gh issue edit ISSUE_NUMBER --repo ${{ github.repository }} --add-label "label1"`
76+
- `gh issue edit ISSUE_NUMBER --repo ${{ github.repository }} --add-label "label2"`
77+
- Continue for each label separately
78+
79+
IMPORTANT: Label each issue individually, one command per issue, one label at a time if needed.
6780
6881
Guidelines:
69-
- Only use existing repository labels
70-
- Do not add comments
71-
- Triage each issue independently
72-
- Focus on: kind/*, area/*, priority/* labels
82+
- Only use existing repository labels from step 1
83+
- Do not add comments to issues
84+
- Triage each issue independently based on title and body content
85+
- Focus on applying: kind/* (bug/enhancement/documentation), area/* (core/cli/testing/windows), and priority/* labels
86+
- If an issue has insufficient information, consider applying "status/need-information"
87+
- After applying appropriate labels to an issue, remove the "status/need-triage" label if present: `gh issue edit ISSUE_NUMBER --repo ${{ github.repository }} --remove-label "status/need-triage"`
88+
- Execute one `gh issue edit` command per issue, wait for success before proceeding to the next
89+
90+
Example triage logic:
91+
- Issues with "bug", "error", "broken" → kind/bug
92+
- Issues with "feature", "enhancement", "improve" → kind/enhancement
93+
- Issues about Windows/performance → area/windows, area/performance
94+
- Critical bugs → priority/p0, other bugs → priority/p1, enhancements → priority/p2
95+
96+
Process each issue sequentially and confirm each labeling operation before moving to the next issue.

0 commit comments

Comments
 (0)