Skip to content

Commit 718d7f1

Browse files
committed
feat: add documentation, workflows, and issue templates for Gemini CLI on GitHub
- Add comprehensive documentation in the docs/ directory for configuration, authentication, observability, issue triage, and PR review - Add example GitHub Actions workflows for automated issue triage, scheduled triage, and PR review using Gemini CLI - Add GitHub issue templates for bug reports and feature requests - Add scripts for setting up Google Cloud Workload Identity Federation and OpenTelemetry collector - Update .gitignore to include environment files, OS/IDE files, and Gemini CLI settings - Overhaul action.yml to support new inputs, telemetry, and improved installation logic - Update README.md and CONTRIBUTING.md with new usage and contribution guidelines
1 parent dac2fd4 commit 718d7f1

33 files changed

+2619
-2685
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
version: 2
23
updates:
34
- package-ecosystem: 'npm'
@@ -7,4 +8,4 @@ updates:
78
interval: 'daily'
89
commit-message:
910
prefix: 'security: '
10-
open-pull-requests-limit: 0 # only check security updates
11+
open-pull-requests-limit: 0 # only check security updates

.github/workflows/draft-release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
---
12
name: 'Draft release'
23

3-
on:
4+
on: # yamllint disable-line rule:truthy
45
workflow_dispatch:
56
inputs:
67
version_strategy:
@@ -19,7 +20,7 @@ permissions:
1920

2021
jobs:
2122
draft-release:
22-
uses: 'google-github-actions/.github/.github/workflows/draft-release.yml@v3' # ratchet:exclude
23+
uses: 'google-github-actions/.github/.github/workflows/draft-release.yml@v3' # ratchet:exclude
2324
with:
2425
version_strategy: '${{ github.event.inputs.version_strategy }}'
2526
secrets:
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
name: '🏷️ Gemini Automated Issue Triage'
3+
on: # yamllint disable-line rule:truthy
4+
issues:
5+
types:
6+
- 'opened'
7+
- 'reopened'
8+
9+
jobs:
10+
triage-issue:
11+
timeout-minutes: 5
12+
permissions:
13+
issues: 'write'
14+
contents: 'read'
15+
id-token: 'write'
16+
concurrency:
17+
group: '${{ github.workflow }}-${{ github.event.issue.number }}'
18+
# yamllint disable-line rule:truthy
19+
cancel-in-progress: true
20+
runs-on: 'ubuntu-latest'
21+
steps:
22+
- name: 'Generate GitHub App Token'
23+
id: 'generate_token'
24+
if: ${{ vars.APP_ID }}
25+
uses: 'actions/create-github-app-token@v1'
26+
with:
27+
app-id: '${{ vars.APP_ID }}'
28+
private-key: '${{ secrets.APP_PRIVATE_KEY }}'
29+
30+
- name: 'Checkout repository'
31+
uses: 'actions/checkout@v4'
32+
with:
33+
token: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
34+
35+
- name: 'Run Gemini Issue Triage'
36+
uses: './'
37+
env:
38+
GITHUB_TOKEN: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
39+
ISSUE_TITLE: '${{ github.event.issue.title }}'
40+
ISSUE_BODY: '${{ github.event.issue.body }}'
41+
ISSUE_NUMBER: '${{ github.event.issue.number }}'
42+
REPOSITORY: '${{ github.repository }}'
43+
GEMINI_CLI_VERSION: '${{ vars.GEMINI_CLI_VERSION }}'
44+
OTLP_GOOGLE_CLOUD_PROJECT: '${{ vars.OTLP_GOOGLE_CLOUD_PROJECT }}'
45+
OTLP_GCP_WIF_PROVIDER: '${{ vars.OTLP_GCP_WIF_PROVIDER }}'
46+
GEMINI_API_KEY: '${{ secrets.GEMINI_API_KEY }}'
47+
with:
48+
settings_json: |
49+
{
50+
"coreTools": [
51+
"run_shell_command(gh label list)",
52+
"run_shell_command(gh issue edit)"
53+
],
54+
"telemetry": {
55+
"enabled": true,
56+
"target": "gcp"
57+
},
58+
"sandbox": false
59+
}
60+
prompt: |
61+
## Role
62+
63+
You are an issue triage assistant. Analyze the current GitHub issue
64+
and apply the most appropriate existing labels. Use the available
65+
tools to gather information; do not ask for information to be
66+
provided.
67+
68+
## Steps
69+
70+
1. Run: `gh label list` to get all available labels.
71+
2. Review the issue title and body provided in the environment
72+
variables: "${ISSUE_TITLE}" and "${ISSUE_BODY}".
73+
3. Select the most relevant labels from the existing labels. If
74+
available, set labels that follow the `kind/*`, `area/*`, and
75+
`priority/*` patterns.
76+
4. Apply the selected labels to this issue using:
77+
`gh issue edit "${ISSUE_NUMBER}" --add-label "label1,label2"`
78+
5. If the "status/needs-triage" label is present, remove it using:
79+
`gh issue edit "${ISSUE_NUMBER}" --remove-label "status/needs-triage"`
80+
81+
## Guidelines
82+
83+
- Only use labels that already exist in the repository
84+
- Do not add comments or modify the issue content
85+
- Triage only the current issue
86+
- Assign all applicable labels based on the issue content
87+
- Reference all shell variables as "${VAR}" (with quotes and braces)
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
name: '📋 Gemini Scheduled Issue Triage'
3+
4+
on: # yamllint disable-line rule:truthy
5+
schedule:
6+
- cron: '0 * * * *' # Runs every hour
7+
workflow_dispatch:
8+
9+
jobs:
10+
triage-issues:
11+
timeout-minutes: 10
12+
runs-on: 'ubuntu-latest'
13+
permissions:
14+
contents: 'read'
15+
id-token: 'write'
16+
issues: 'write'
17+
steps:
18+
- name: 'Generate GitHub App Token'
19+
id: 'generate_token'
20+
if: ${{ vars.APP_ID }}
21+
uses: 'actions/create-github-app-token@v1'
22+
with:
23+
app-id: '${{ vars.APP_ID }}'
24+
private-key: '${{ secrets.APP_PRIVATE_KEY }}'
25+
26+
- name: 'Checkout repository'
27+
uses: 'actions/checkout@v4'
28+
with:
29+
token: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
30+
31+
- name: 'Find untriaged issues'
32+
id: 'find_issues'
33+
env:
34+
GITHUB_TOKEN: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
35+
GITHUB_REPOSITORY: '${{ github.repository }}'
36+
GITHUB_OUTPUT: '${{ github.output }}'
37+
shell: bash
38+
run: |
39+
set -euo pipefail
40+
41+
echo '🔍 Finding issues without labels...'
42+
NO_LABEL_ISSUES="$(gh issue list --repo "${GITHUB_REPOSITORY}" \
43+
--search 'is:open is:issue no:label' --json number,title,body)"
44+
45+
echo '🏷️ Finding issues that need triage...'
46+
NEED_TRIAGE_ISSUES="$(gh issue list --repo "${GITHUB_REPOSITORY}" \
47+
--search 'is:open is:issue label:"status/needs-triage"' --json number,title,body)"
48+
49+
echo '🔄 Merging and deduplicating issues...'
50+
ISSUES="$(echo "${NO_LABEL_ISSUES}" "${NEED_TRIAGE_ISSUES}" | jq -c -s 'add | unique_by(.number)')"
51+
52+
echo '📝 Setting output for GitHub Actions...'
53+
echo "issues_to_triage=${ISSUES}" >> "${GITHUB_OUTPUT}"
54+
55+
ISSUE_COUNT="$(echo "${ISSUES}" | jq 'length')"
56+
echo "✅ Found ${ISSUE_COUNT} issues to triage! 🎯"
57+
58+
- name: 'Run Gemini Issue Triage'
59+
if: steps.find_issues.outputs.issues_to_triage != '[]'
60+
uses: './'
61+
env:
62+
GITHUB_TOKEN: '${{ steps.generate_token.outputs.token }}'
63+
ISSUES_TO_TRIAGE: '${{ steps.find_issues.outputs.issues_to_triage }}'
64+
REPOSITORY: '${{ github.repository }}'
65+
GEMINI_CLI_VERSION: '${{ vars.GEMINI_CLI_VERSION }}'
66+
OTLP_GOOGLE_CLOUD_PROJECT: '${{ vars.OTLP_GOOGLE_CLOUD_PROJECT }}'
67+
OTLP_GCP_WIF_PROVIDER: '${{ vars.OTLP_GCP_WIF_PROVIDER }}'
68+
GEMINI_API_KEY: '${{ secrets.GEMINI_API_KEY }}'
69+
with:
70+
settings_json: |
71+
{
72+
"coreTools": [
73+
"run_shell_command(echo)",
74+
"run_shell_command(gh label list)",
75+
"run_shell_command(gh issue edit)",
76+
"run_shell_command(gh issue list)"
77+
],
78+
"telemetry": {
79+
"enabled": true,
80+
"target": "gcp"
81+
},
82+
"sandbox": false
83+
}
84+
prompt: |
85+
## Role
86+
87+
You are an issue triage assistant. Analyze issues and apply
88+
appropriate labels. Use the available tools to gather information;
89+
do not ask for information to be provided.
90+
91+
## Steps
92+
93+
1. Run: `gh label list`
94+
2. Check environment variable: "${ISSUES_TO_TRIAGE}" (JSON array
95+
of issues)
96+
3. For each issue, apply labels:
97+
`gh issue edit "${ISSUE_NUMBER}" --add-label "label1,label2"`.
98+
If available, set labels that follow the `kind/*`, `area/*`,
99+
and `priority/*` patterns.
100+
4. For each issue, if the `status/needs-triage` label is present,
101+
remove it using:
102+
`gh issue edit "${ISSUE_NUMBER}" --remove-label "status/needs-triage"`
103+
104+
## Guidelines
105+
106+
- Only use existing repository labels
107+
- Do not add comments
108+
- Triage each issue independently
109+
- Reference all shell variables as "${VAR}" (with quotes and braces)

0 commit comments

Comments
 (0)