Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ inputs:
description: 'The GitHub workflow name, used for telemetry purposes.'
required: false
default: '${{ github.workflow }}'
github_pr_number:
description: 'The Pull Request number the CLI is operating on. Defaults to the event payload.'
required: false
default: '${{ github.event.pull_request.number }}'
github_issue_number:
description: 'The Issue number the CLI is operating on. Defaults to the event payload.'
required: false
default: '${{ github.event.issue.number }}'
github_custom_tracking_id:
description: 'A custom tracking ID (e.g. comma-separated list of issue IDs for scheduled batches).'
required: false

outputs:
summary:
Expand Down Expand Up @@ -231,6 +242,11 @@ runs:
GEMINI_CLI_VERSION: '${{ inputs.gemini_cli_version }}'
EXTENSIONS: '${{ inputs.extensions }}'
USE_PNPM: '${{ inputs.use_pnpm }}'
SURFACE: 'GitHub'
GH_WORKFLOW_NAME: '${{ steps.sanitize_workflow_name.outputs.gh_workflow_name }}'
GH_PR_NUMBER: '${{ inputs.github_pr_number }}'
GH_ISSUE_NUMBER: '${{ inputs.github_issue_number }}'
GH_CUSTOM_TRACKING_ID: '${{ inputs.github_custom_tracking_id }}'
shell: 'bash'
run: |-
set -euo pipefail
Expand Down Expand Up @@ -414,6 +430,9 @@ runs:
PROMPT: '${{ inputs.prompt }}'
GEMINI_MODEL: '${{ inputs.gemini_model }}'
GH_WORKFLOW_NAME: '${{ steps.sanitize_workflow_name.outputs.gh_workflow_name }}'
GH_PR_NUMBER: '${{ inputs.github_pr_number }}'
GH_ISSUE_NUMBER: '${{ inputs.github_issue_number }}'
GH_CUSTOM_TRACKING_ID: '${{ inputs.github_custom_tracking_id }}'

- name: 'Upload Gemini CLI outputs'
if: |-
Expand All @@ -440,6 +459,9 @@ runs:
sed -e "s#OTLP_GOOGLE_CLOUD_PROJECT#${OTLP_GOOGLE_CLOUD_PROJECT}#g" \
-e "s#GITHUB_REPOSITORY_PLACEHOLDER#${GITHUB_REPOSITORY}#g" \
-e "s#GITHUB_RUN_ID_PLACEHOLDER#${GITHUB_RUN_ID}#g" \
-e "s#GITHUB_PR_NUMBER_PLACEHOLDER#${GITHUB_PR_NUMBER}#g" \
-e "s#GITHUB_ISSUE_NUMBER_PLACEHOLDER#${GITHUB_ISSUE_NUMBER}#g" \
-e "s#GITHUB_CUSTOM_TRACKING_ID_PLACEHOLDER#${GITHUB_CUSTOM_TRACKING_ID}#g" \
"${GITHUB_ACTION_PATH}/scripts/collector-gcp.yaml.template" > ".gemini/collector-gcp.yaml"

# Ensure credentials file has the right permissions
Expand Down Expand Up @@ -490,6 +512,9 @@ runs:
GITHUB_ACTION_PATH: '${{ github.action_path }}'
GITHUB_REPOSITORY: '${{ github.repository }}'
GITHUB_RUN_ID: '${{ github.run_id }}'
GITHUB_PR_NUMBER: '${{ inputs.github_pr_number }}'
GITHUB_ISSUE_NUMBER: '${{ inputs.github_issue_number }}'
GITHUB_CUSTOM_TRACKING_ID: '${{ inputs.github_custom_tracking_id }}'

branding:
icon: 'terminal'
Expand Down
4 changes: 4 additions & 0 deletions examples/workflows/gemini-assistant/gemini-invoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ jobs:
use_vertex_ai: '${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}'
upload_artifacts: '${{ vars.UPLOAD_ARTIFACTS }}'
workflow_name: 'gemini-invoke'
# Assistant workflows can be triggered by comments on either Issues or PRs.
# We explicitly map both fields so the CLI can correctly categorize the interaction.
github_pr_number: '${{ github.event.pull_request.number }}'
github_issue_number: '${{ github.event.issue.number }}'
settings: |-
{
"model": {
Expand Down
4 changes: 4 additions & 0 deletions examples/workflows/gemini-assistant/gemini-plan-execute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ jobs:
use_vertex_ai: '${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}'
upload_artifacts: '${{ vars.UPLOAD_ARTIFACTS }}'
workflow_name: 'gemini-invoke'
# Assistant workflows can be triggered by comments on either Issues or PRs.
# We explicitly map both fields so the CLI can correctly categorize the interaction.
github_pr_number: '${{ github.event.pull_request.number }}'
github_issue_number: '${{ github.event.issue.number }}'
settings: |-
{
"model": {
Expand Down
6 changes: 6 additions & 0 deletions examples/workflows/issue-triage/gemini-scheduled-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ jobs:
echo '📝 Setting output for GitHub Actions...'
echo "issues_to_triage=${ISSUES}" >> "${GITHUB_OUTPUT}"

ISSUE_NUMBERS="$(echo "${ISSUES}" | jq -r '.[].number | tostring' | paste -sd, -)"
echo "issue_numbers=${ISSUE_NUMBERS}" >> "${GITHUB_OUTPUT}"

ISSUE_COUNT="$(echo "${ISSUES}" | jq 'length')"
echo "✅ Found ${ISSUE_COUNT} issue(s) to triage! 🎯"

Expand Down Expand Up @@ -109,6 +112,9 @@ jobs:
use_vertex_ai: '${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}'
upload_artifacts: '${{ vars.UPLOAD_ARTIFACTS }}'
workflow_name: 'gemini-scheduled-triage'
# Overriding default telemetry inputs because scheduled workflows lack an event payload
# We pass the dynamically generated list of batch issues to the custom tracking ID field
github_custom_tracking_id: '${{ steps.find_issues.outputs.issue_numbers }}'
settings: |-
{
"model": {
Expand Down
2 changes: 2 additions & 0 deletions examples/workflows/issue-triage/gemini-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ jobs:
use_vertex_ai: '${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}'
upload_artifacts: '${{ vars.UPLOAD_ARTIFACTS }}'
workflow_name: 'gemini-triage'
# Explicitly set the issue number to handle `issue_comment` triggers where the context might be ambiguous
github_issue_number: '${{ github.event.issue.number }}'
settings: |-
{
"model": {
Expand Down
2 changes: 2 additions & 0 deletions examples/workflows/pr-review/gemini-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ jobs:
use_vertex_ai: '${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}'
upload_artifacts: '${{ vars.UPLOAD_ARTIFACTS }}'
workflow_name: 'gemini-review'
# Explicitly set the PR number to handle `issue_comment` triggers (which GitHub treats as issues, not PRs)
github_pr_number: '${{ github.event.pull_request.number }}'
settings: |-
{
"model": {
Expand Down
9 changes: 9 additions & 0 deletions scripts/collector-gcp.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ processors:
- key: 'github.run_id'
value: 'GITHUB_RUN_ID_PLACEHOLDER'
action: 'upsert'
- key: 'github.pr.number'
value: 'GITHUB_PR_NUMBER_PLACEHOLDER'
action: 'upsert'
- key: 'github.issue.number'
value: 'GITHUB_ISSUE_NUMBER_PLACEHOLDER'
action: 'upsert'
- key: 'github.custom_tracking.id'
value: 'GITHUB_CUSTOM_TRACKING_ID_PLACEHOLDER'
action: 'upsert'
batch:
send_batch_size: 100
timeout: '10s'
Expand Down
Loading