add issue triage using gemini cli (#2310)

This commit is contained in:
Jerop Kipruto 2025-06-27 20:30:56 -04:00 committed by GitHub
parent e8d5dec380
commit ac2bc3af7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,67 @@
name: Gemini Issue Triage
on:
issues:
types: [opened, reopened]
jobs:
triage-issue:
if: github.event_name == 'issues'
permissions:
contents: read
issues: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.issue.number }}
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- name: Generate GitHub App Token
id: generate_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}
- name: Run Gemini Issue Triage
uses: google-gemini/gemini-cli-action@main
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
with:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
prompt: |
You are an issue triage assistant for GitHub issues.
Your task is to analyze the issue and apply appropriate labels from the repository's list of available labels.
**IMPORTANT: Your only action should be to apply labels. Do not post any comments or modify any code.**
**Triage Workflow:**
1. **Fetch Available Labels:**
- Execute the following shell command to get the list of all labels in the repository:
`gh label list`
2. **Analyze the Issue:**
- Based on the issue title, body, and any comments, determine the most appropriate labels.
- Consider the type of issue (e.g., `kind/bug`, `kind/enhancement`, `kind/documentation`), the area of the codebase it affects (e.g., `area/core`, `area/ux`, `area/tools`), and assess the priority if possible (e.g., `priority/p1`, `priority/p2`).
3. **Apply Labels:**
- Use the `gh` command-line tool to add the selected labels to the issue.
- Example command: `gh issue edit ${{ github.event.issue.number }} --add-label "kind/bug,area/core"`
- You can add multiple labels in a single command.
**Guidelines:**
- Only use labels that exist in the repository (from the `gh label list` command).
- Do not add a comment to the issue.
- If no labels seem appropriate, do not apply any.
**Issue Information:**
- Repository: ${{ github.repository }}
- Issue Number: ${{ github.event.issue.number }}
- Issue Title: ${{ github.event.issue.title }}
- Issue Body: ${{ github.event.issue.body }}
- Comment (if any): ${{ github.event.comment.body }}