Skip to content

Commit 3af560a

Browse files
committed
feat(triage): improve automated issue triage workflows
This commit enhances the GitHub Actions workflows for automated issue triage. The key changes include: - Bumping the `gemini-cli-action` to the latest version. - Making all `gh` CLI calls repository-aware by adding the `--repo` flag to prevent errors when the workflows are forked. - Improving the prompts for the Gemini CLI to be more specific and provide better guidance on how to triage issues. - In the scheduled triage workflow: - Issues are now passed to the Gemini CLI via a temporary file to handle a larger number of issues. - The workflow now also triages issues with the "status/needs-triage" label, in addition to issues with no labels.
1 parent 36e099a commit 3af560a

File tree

2 files changed

+54
-27
lines changed

2 files changed

+54
-27
lines changed

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

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,41 +23,48 @@ 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 }}
26+
- name: Authenticate GitHub CLI
27+
run: |
28+
echo "$GITHUB_TOKEN" | gh auth login --with-token
29+
env:
30+
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
3031

3132
- name: Run Gemini Issue Triage
32-
uses: google-gemini/gemini-cli-action@111dadaecabd309baba60f56f2b520c52c0f9a47
33+
uses: google-gemini/gemini-cli-action@41c0f1b3cbd1a0b284251bd1aac034edd07a3a2f
3334
env:
3435
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
3536
ISSUE_TITLE: ${{ github.event.issue.title }}
3637
ISSUE_BODY: ${{ github.event.issue.body }}
3738
ISSUE_NUMBER: ${{ github.event.issue.number }}
3839
REPOSITORY: ${{ github.repository }}
3940
with:
40-
version: 0.1.8-rc.0
41+
version: latest
4142
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
4243
OTLP_GCP_WIF_PROVIDER: ${{ secrets.OTLP_GCP_WIF_PROVIDER }}
4344
OTLP_GCP_SERVICE_ACCOUNT: ${{ secrets.OTLP_GCP_SERVICE_ACCOUNT }}
4445
OTLP_GOOGLE_CLOUD_PROJECT: ${{ secrets.OTLP_GOOGLE_CLOUD_PROJECT }}
4546
settings_json: |
4647
{
4748
"coreTools": [
48-
"run_shell_command(gh label list)",
49-
"run_shell_command(gh issue edit)",
50-
"run_shell_command(gh issue list)"
51-
],
49+
"run_shell_command(gh label list --repo $REPOSITORY)",
50+
"run_shell_command(gh issue edit --repo $REPOSITORY)",
51+
"run_shell_command(gh issue list --repo $REPOSITORY)"
52+
]
5253
}
5354
prompt: |
5455
You are an issue triage assistant. Analyze the current GitHub issue and apply the most appropriate existing labels.
5556
5657
Steps:
57-
1. Run: `gh label list --limit 100` to get all available labels.
58+
1. Run: `gh label list --repo $REPOSITORY --limit 100` to get all available labels.
5859
2. Review the issue title and body provided in the environment variables.
5960
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"`
61+
4. Apply the selected labels to this issue using: `gh issue edit $ISSUE_NUMBER --repo $REPOSITORY --add-label "label1,label2"`
62+
63+
Guidelines:
64+
- Only use labels that already exist in the repository.
65+
- Do not add comments or modify the issue content.
66+
- Triage only the current issue.
67+
- Assign all applicable kind/*, area/*, and priority/* labels based on the issue content.
6168
6269
Guidelines:
6370
- Only use labels that already exist in the repository.

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

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,39 @@ 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 }}
24+
- name: Authenticate GitHub CLI
25+
run: |
26+
echo "$GITHUB_TOKEN" | gh auth login --with-token
27+
env:
28+
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
2829

2930
- name: Find untriaged issues
3031
id: find_issues
3132
env:
3233
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
3334
run: |
35+
echo "🔍 Finding issues without labels..."
3436
NO_LABEL_ISSUES=$(gh issue list --repo ${{ github.repository }} --search "is:open is:issue no:label" --json number,title,body)
37+
38+
echo "🏷️ Finding issues that need triage..."
3539
NEEDS_TRIAGE_ISSUES=$(gh issue list --repo ${{ github.repository }} --search "is:open is:issue label:\"status/needs-triage\"" --json number,title,body)
40+
41+
echo "🔄 Merging and deduplicating issues..."
3642
ISSUES=$(echo "$NO_LABEL_ISSUES" "$NEEDS_TRIAGE_ISSUES" | jq -c -s 'add | unique_by(.number)')
43+
44+
echo "📝 Setting output for GitHub Actions..."
3745
echo "issues_to_triage=$ISSUES" >> "$GITHUB_OUTPUT"
46+
47+
echo "💾 Writing issues to temporary file for Gemini CLI..."
48+
echo "$ISSUES" > /tmp/issues_to_triage.json
49+
50+
echo "✅ Found $(echo "$ISSUES" | jq 'length') issues to triage! 🎯"
3851
3952
- name: Run Gemini Issue Triage
4053
if: steps.find_issues.outputs.issues_to_triage != '[]'
41-
uses: google-gemini/gemini-cli-action@111dadaecabd309baba60f56f2b520c52c0f9a47
54+
uses: google-gemini/gemini-cli-action@41c0f1b3cbd1a0b284251bd1aac034edd07a3a2f
4255
env:
4356
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
44-
ISSUES_TO_TRIAGE: ${{ steps.find_issues.outputs.issues_to_triage }}
4557
REPOSITORY: ${{ github.repository }}
4658
with:
4759
version: 0.1.8-rc.0
@@ -54,19 +66,27 @@ jobs:
5466
"coreTools": [
5567
"run_shell_command(gh label list)",
5668
"run_shell_command(gh issue edit)",
57-
"run_shell_command(gh issue list)"
58-
],
69+
"run_shell_command(gh issue list)",
70+
"run_shell_command(cat /tmp/issues_to_triage.json)"
71+
]
5972
}
6073
prompt: |
6174
You are an issue triage assistant. Analyze issues and apply appropriate labels.
6275
6376
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"`
77+
1. Run: `gh label list --limit 100` to see available labels
78+
2. Run: `cat /tmp/issues_to_triage.json` to get the issues that need triaging
79+
3. Parse the JSON array from step 2 and for each issue, apply appropriate labels using: `gh issue edit ISSUE_NUMBER --add-label "label1,label2"`
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+
88+
Example triage logic:
89+
- Issues with "bug", "error", "broken" → kind/bug
90+
- Issues with "feature", "enhancement", "improve" → kind/enhancement
91+
- Issues about Windows/performance → area/windows, area/performance
92+
- Critical bugs → priority/p0, other bugs → priority/p1, enhancements → priority/p2

0 commit comments

Comments
 (0)