gemini-issue-automated-triage.yml
1 name: Gemini Automated Issue Triage 2 3 # on: 4 # issue_comment: 5 # types: [created] 6 on: 7 workflow_dispatch: 8 9 jobs: 10 triage-issue: 11 if: > 12 github.event_name == 'issue_comment' && 13 !github.event.issue.pull_request && 14 contains(github.event.comment.body, '@gemini triage') && 15 (github.event.comment.author_association == 'OWNER' || 16 github.event.comment.author_association == 'MEMBER' || 17 github.event.comment.author_association == 'COLLABORATOR') 18 timeout-minutes: 5 19 permissions: 20 issues: write 21 contents: read 22 id-token: write 23 concurrency: 24 group: ${{ github.workflow }}-${{ github.event.issue.number }} 25 cancel-in-progress: true 26 runs-on: ubuntu-latest 27 steps: 28 - name: Generate GitHub App Token 29 id: generate_token 30 uses: actions/create-github-app-token@v1 31 with: 32 app-id: ${{ secrets.APP_ID }} 33 private-key: ${{ secrets.PRIVATE_KEY }} 34 35 - name: Checkout repository 36 uses: actions/checkout@v4 37 with: 38 persist-credentials: false 39 with: 40 persist-credentials: false 41 with: 42 token: ${{ steps.generate_token.outputs.token }} 43 44 - name: Run Gemini Issue Triage 45 uses: google-gemini/gemini-cli-action@main 46 env: 47 GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} 48 ISSUE_TITLE: ${{ github.event.issue.title }} 49 ISSUE_BODY: ${{ github.event.issue.body }} 50 ISSUE_NUMBER: ${{ github.event.issue.number }} 51 REPOSITORY: ${{ github.repository }} 52 with: 53 version: 0.1.8-rc.0 54 GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} 55 OTLP_GCP_WIF_PROVIDER: ${{ secrets.OTLP_GCP_WIF_PROVIDER }} 56 OTLP_GOOGLE_CLOUD_PROJECT: ${{ secrets.OTLP_GOOGLE_CLOUD_PROJECT }} 57 settings_json: | 58 { 59 "coreTools": [ 60 "run_shell_command(gh label list)", 61 "run_shell_command(gh issue edit)" 62 ], 63 "telemetry": { 64 "enabled": true, 65 "target": "gcp" 66 }, 67 "sandbox": false 68 } 69 prompt: | 70 You are an issue triage assistant. Analyze the current GitHub issue and apply the most appropriate existing labels. 71 72 Steps: 73 1. Run: `gh label list --limit 100` to get all available labels. 74 2. Review the issue title and body provided in the environment variables. 75 3. Select the most relevant labels from the existing labels, focusing on kind/*, area/*, and priority/*. 76 4. Apply the selected labels to this issue using: `gh issue edit ISSUE_NUMBER --add-label "label1,label2"` 77 78 Guidelines: 79 - Only use labels that already exist in the repository. 80 - Do not add comments or modify the issue content. 81 - Triage only the current issue. 82 - Assign all applicable kind/*, area/*, and priority/* labels based on the issue content.