mirror of https://github.com/flutter/samples.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
130 lines
4.9 KiB
130 lines
4.9 KiB
name: '🏷️ Gemini Automated Issue Triage'
|
|
|
|
on:
|
|
issues:
|
|
types:
|
|
- 'opened'
|
|
- 'reopened'
|
|
issue_comment:
|
|
types:
|
|
- 'created'
|
|
workflow_dispatch:
|
|
inputs:
|
|
issue_number:
|
|
description: 'issue number to triage'
|
|
required: true
|
|
type: 'number'
|
|
|
|
concurrency:
|
|
group: '${{ github.workflow }}-${{ github.event.issue.number }}'
|
|
cancel-in-progress: true
|
|
|
|
defaults:
|
|
run:
|
|
shell: 'bash'
|
|
|
|
permissions:
|
|
contents: 'read'
|
|
id-token: 'write'
|
|
issues: 'write'
|
|
statuses: 'write'
|
|
|
|
jobs:
|
|
triage-issue:
|
|
if: >
|
|
github.event_name == 'issues' ||
|
|
github.event_name == 'workflow_dispatch' ||
|
|
(github.event_name == 'issue_comment' &&
|
|
contains(github.event.comment.body, '@gemini-cli /triage') &&
|
|
(github.event.comment.author_association == 'OWNER' ||
|
|
github.event.comment.author_association == 'MEMBER' ||
|
|
github.event.comment.author_association == 'COLLABORATOR'))
|
|
timeout-minutes: 5
|
|
runs-on: 'ubuntu-latest'
|
|
|
|
steps:
|
|
- name: 'Checkout repository'
|
|
uses: 'actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683' # ratchet:actions/checkout@v4
|
|
|
|
- name: 'Generate GitHub App Token'
|
|
id: 'generate_token'
|
|
if: |-
|
|
${{ vars.APP_ID }}
|
|
uses: 'actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e' # ratchet:actions/create-github-app-token@v2
|
|
with:
|
|
app-id: '${{ vars.APP_ID }}'
|
|
private-key: '${{ secrets.APP_PRIVATE_KEY }}'
|
|
|
|
- name: 'Run Gemini Issue Triage'
|
|
uses: 'google-github-actions/run-gemini-cli@v0'
|
|
id: 'gemini_issue_triage'
|
|
env:
|
|
GITHUB_TOKEN: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
|
|
ISSUE_TITLE: '${{ github.event.issue.title }}'
|
|
ISSUE_BODY: '${{ github.event.issue.body }}'
|
|
ISSUE_NUMBER: '${{ github.event.issue.number }}'
|
|
REPOSITORY: '${{ github.repository }}'
|
|
with:
|
|
gemini_cli_version: '${{ vars.GEMINI_CLI_VERSION }}'
|
|
gcp_workload_identity_provider: '${{ vars.GCP_WIF_PROVIDER }}'
|
|
gcp_project_id: '${{ vars.GOOGLE_CLOUD_PROJECT }}'
|
|
gcp_location: '${{ vars.GOOGLE_CLOUD_LOCATION }}'
|
|
gcp_service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
|
|
gemini_api_key: '${{ secrets.GEMINI_API_KEY }}'
|
|
use_vertex_ai: '${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}'
|
|
use_gemini_code_assist: '${{ vars.GOOGLE_GENAI_USE_GCA }}'
|
|
settings: |-
|
|
{
|
|
"maxSessionTurns": 25,
|
|
"coreTools": [
|
|
"run_shell_command(gh label list)",
|
|
"run_shell_command(gh issue edit)"
|
|
],
|
|
"telemetry": {
|
|
"enabled": false,
|
|
"target": "gcp"
|
|
}
|
|
}
|
|
prompt: |-
|
|
## Role
|
|
|
|
You are an issue triage assistant. Analyze the current GitHub issue
|
|
and apply the most appropriate existing labels. Use the available
|
|
tools to gather information; do not ask for information to be
|
|
provided.
|
|
|
|
## Steps
|
|
|
|
1. Run: `gh label list` to get all available labels.
|
|
2. Review the issue title and body provided in the environment
|
|
variables: "${ISSUE_TITLE}" and "${ISSUE_BODY}".
|
|
3. Select the most relevant labels from the existing labels. If
|
|
available, set labels that follow the `kind/*`, `area/*`, and
|
|
`priority/*` patterns.
|
|
4. Apply the selected labels to this issue using:
|
|
`gh issue edit "${ISSUE_NUMBER}" --add-label "label1,label2"`
|
|
5. If the "status/needs-triage" label is present, remove it using:
|
|
`gh issue edit "${ISSUE_NUMBER}" --remove-label "status/needs-triage"`
|
|
|
|
## Guidelines
|
|
|
|
- Only use labels that already exist in the repository
|
|
- Do not add comments or modify the issue content
|
|
- Triage only the current issue
|
|
- Assign all applicable labels based on the issue content
|
|
- Reference all shell variables as "${VAR}" (with quotes and braces)
|
|
|
|
- name: 'Post Issue Triage Failure Comment'
|
|
if: |-
|
|
${{ failure() && steps.gemini_issue_triage.outcome == 'failure' }}
|
|
uses: 'actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea'
|
|
with:
|
|
github-token: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
|
|
script: |-
|
|
github.rest.issues.createComment({
|
|
owner: '${{ github.repository }}'.split('/')[0],
|
|
repo: '${{ github.repository }}'.split('/')[1],
|
|
issue_number: '${{ github.event.issue.number }}',
|
|
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.'
|
|
})
|