1+ name : ' 🏷️ Gemini Automated Issue Triage'
2+
3+ on :
4+ issues :
5+ types :
6+ - ' opened'
7+ - ' reopened'
8+ issue_comment :
9+ types :
10+ - ' created'
11+ workflow_dispatch :
12+ inputs :
13+ issue_number :
14+ description : ' issue number to triage'
15+ required : true
16+ type : ' number'
17+
18+ concurrency :
19+ group : ' ${{ github.workflow }}-${{ github.event.issue.number }}'
20+ cancel-in-progress : true
21+
22+ defaults :
23+ run :
24+ shell : ' bash'
25+
26+ permissions :
27+ contents : ' read'
28+ id-token : ' write'
29+ issues : ' write'
30+ statuses : ' write'
31+
32+ jobs :
33+ triage-issue :
34+ if : |-
35+ github.event_name == 'issues' ||
36+ github.event_name == 'workflow_dispatch' ||
37+ (
38+ github.event_name == 'issue_comment' &&
39+ contains(github.event.comment.body, '@gemini-cli /triage') &&
40+ contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)
41+ )
42+ timeout-minutes : 5
43+ runs-on : ' ubuntu-latest'
44+
45+ steps :
46+ - name : ' Checkout repository'
47+ uses : ' actions/checkout@v5'
48+
49+ - name : ' Run Gemini Issue Triage'
50+ uses : ' ./'
51+ id : ' gemini_issue_triage'
52+ env :
53+ GITHUB_TOKEN : ' ${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
54+ ISSUE_TITLE : ' ${{ github.event.issue.title }}'
55+ ISSUE_BODY : ' ${{ github.event.issue.body }}'
56+ ISSUE_NUMBER : ' ${{ github.event.issue.number }}'
57+ REPOSITORY : ' ${{ github.repository }}'
58+ with :
59+ gemini_cli_version : ' ${{ vars.GEMINI_CLI_VERSION }}'
60+ gcp_workload_identity_provider : ' ${{ vars.GCP_WIF_PROVIDER }}'
61+ gcp_project_id : ' ${{ vars.GOOGLE_CLOUD_PROJECT }}'
62+ gcp_location : ' ${{ vars.GOOGLE_CLOUD_LOCATION }}'
63+ gcp_service_account : ' ${{ vars.SERVICE_ACCOUNT_EMAIL }}'
64+ gemini_api_key : ' ${{ secrets.GEMINI_API_KEY }}'
65+ use_vertex_ai : ' ${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}'
66+ use_gemini_code_assist : ' ${{ vars.GOOGLE_GENAI_USE_GCA }}'
67+ settings : |-
68+ {
69+ "maxSessionTurns": 25,
70+ "coreTools": [
71+ "run_shell_command(echo)",
72+ "run_shell_command(gh label list)",
73+ "run_shell_command(gh issue edit)"
74+ ],
75+ "telemetry": {
76+ "enabled": true,
77+ "target": "gcp"
78+ }
79+ }
80+ prompt : |-
81+ ## Role
82+
83+ You are an issue triage assistant. Analyze the current GitHub issue
84+ and apply the most appropriate existing labels. Use the available
85+ tools to gather information; do not ask for information to be
86+ provided.
87+
88+ ## Steps
89+
90+ 1. Run: `gh label list` to get all available labels.
91+ 2. Review the issue title and body provided in the environment
92+ variables: "${ISSUE_TITLE}" and "${ISSUE_BODY}".
93+ 3. Classify issues by their kind (bug, enhancement, documentation,
94+ cleanup, etc) and their priority (p0, p1, p2, p3). Set the
95+ labels accoridng to the format `kind/*` and `priority/*` patterns.
96+ 4. Apply the selected labels to this issue using:
97+ `gh issue edit "${ISSUE_NUMBER}" --add-label "label1,label2"`
98+ 5. If the "status/needs-triage" label is present, remove it using:
99+ `gh issue edit "${ISSUE_NUMBER}" --remove-label "status/needs-triage"`
100+
101+ ## Guidelines
102+
103+ - Only use labels that already exist in the repository
104+ - Do not add comments or modify the issue content
105+ - Triage only the current issue
106+ - Assign all applicable labels based on the issue content
107+ - Reference all shell variables as "${VAR}" (with quotes and braces)
108+
109+ - name : ' Post Issue Triage Failure Comment'
110+ if : |-
111+ ${{ failure() && steps.gemini_issue_triage.outcome == 'failure' }}
112+ uses : ' actions/github-script@v7'
113+ with :
114+ github-token : ' ${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
115+ script : |-
116+ github.rest.issues.createComment({
117+ owner: '${{ github.repository }}'.split('/')[0],
118+ repo: '${{ github.repository }}'.split('/')[1],
119+ issue_number: '${{ github.event.issue.number }}',
120+ body: 'There is a problem with the Gemini CLI issue triaging. Please check the [action logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.'
121+ })
0 commit comments