|
| 1 | +name: '🧙 Gemini Plan Execution' |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + additional_context: |
| 7 | + type: 'string' |
| 8 | + description: 'Any additional context from the request' |
| 9 | + required: false |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: '${{ github.workflow }}-plan-execute-${{ github.event_name }}-${{ github.event.pull_request.number }}' |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +defaults: |
| 16 | + run: |
| 17 | + shell: 'bash' |
| 18 | + |
| 19 | +jobs: |
| 20 | + plan-execute: |
| 21 | + timeout-minutes: 30 |
| 22 | + runs-on: 'ubuntu-latest' |
| 23 | + permissions: |
| 24 | + contents: 'write' |
| 25 | + id-token: 'write' |
| 26 | + pull-requests: 'write' |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: 'Mint identity token' |
| 30 | + id: 'mint_identity_token' |
| 31 | + if: |- |
| 32 | + ${{ vars.APP_ID }} |
| 33 | + uses: 'actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf' # ratchet:actions/create-github-app-token@v2 |
| 34 | + with: |
| 35 | + app-id: '${{ vars.APP_ID }}' |
| 36 | + private-key: '${{ secrets.APP_PRIVATE_KEY }}' |
| 37 | + permission-contents: 'write' |
| 38 | + permission-pull-requests: 'write' |
| 39 | + |
| 40 | + - name: 'Checkout Code' |
| 41 | + uses: 'actions/checkout@v4' # ratchet:exclude |
| 42 | + |
| 43 | + - name: 'Run Gemini CLI' |
| 44 | + id: 'run_gemini' |
| 45 | + uses: 'google-github-actions/run-gemini-cli@v0' # ratchet:exclude |
| 46 | + env: |
| 47 | + TITLE: '${{ github.event.pull_request.title }}' |
| 48 | + DESCRIPTION: '${{ github.event.pull_request.body }}' |
| 49 | + EVENT_NAME: '${{ github.event_name }}' |
| 50 | + GITHUB_TOKEN: '${{ steps.mint_identity_token.outputs.token || secrets.GITHUB_TOKEN || github.token }}' |
| 51 | + IS_PULL_REQUEST: '${{ !!github.event.pull_request }}' |
| 52 | + ISSUE_NUMBER: '${{ github.event.pull_request.number }}' |
| 53 | + REPOSITORY: '${{ github.repository }}' |
| 54 | + ADDITIONAL_CONTEXT: '${{ inputs.additional_context }}' |
| 55 | + with: |
| 56 | + gcp_location: '${{ vars.GOOGLE_CLOUD_LOCATION }}' |
| 57 | + gcp_project_id: '${{ vars.GOOGLE_CLOUD_PROJECT }}' |
| 58 | + gcp_service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}' |
| 59 | + gcp_workload_identity_provider: '${{ vars.GCP_WIF_PROVIDER }}' |
| 60 | + gemini_api_key: '${{ secrets.GEMINI_API_KEY }}' |
| 61 | + gemini_cli_version: '${{ vars.GEMINI_CLI_VERSION }}' |
| 62 | + gemini_debug: '${{ fromJSON(vars.GEMINI_DEBUG || vars.ACTIONS_STEP_DEBUG || false) }}' |
| 63 | + gemini_model: '${{ vars.GEMINI_MODEL }}' |
| 64 | + google_api_key: '${{ secrets.GOOGLE_API_KEY }}' |
| 65 | + use_gemini_code_assist: '${{ vars.GOOGLE_GENAI_USE_GCA }}' |
| 66 | + use_vertex_ai: '${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}' |
| 67 | + upload_artifacts: '${{ vars.UPLOAD_ARTIFACTS }}' |
| 68 | + workflow_name: 'gemini-invoke' |
| 69 | + settings: |- |
| 70 | + { |
| 71 | + "model": { |
| 72 | + "maxSessionTurns": 25 |
| 73 | + }, |
| 74 | + "telemetry": { |
| 75 | + "enabled": true, |
| 76 | + "target": "local", |
| 77 | + "outfile": ".gemini/telemetry.log" |
| 78 | + }, |
| 79 | + "mcpServers": { |
| 80 | + "github": { |
| 81 | + "command": "docker", |
| 82 | + "args": [ |
| 83 | + "run", |
| 84 | + "-i", |
| 85 | + "--rm", |
| 86 | + "-e", |
| 87 | + "GITHUB_PERSONAL_ACCESS_TOKEN", |
| 88 | + "ghcr.io/github/github-mcp-server:v0.27.0" |
| 89 | + ], |
| 90 | + "includeTools": [ |
| 91 | + "add_issue_comment", |
| 92 | + "create_pull_request", |
| 93 | + "pull_request_read", |
| 94 | + "list_pull_requests", |
| 95 | + "search_pull_requests", |
| 96 | + "create_branch", |
| 97 | + "create_or_update_file", |
| 98 | + "delete_file", |
| 99 | + "fork_repository", |
| 100 | + "get_commit", |
| 101 | + "get_file_contents", |
| 102 | + "list_commits", |
| 103 | + "push_files", |
| 104 | + "search_code" |
| 105 | + ], |
| 106 | + "env": { |
| 107 | + "GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}" |
| 108 | + } |
| 109 | + } |
| 110 | + }, |
| 111 | + "tools": { |
| 112 | + "core": [ |
| 113 | + "run_shell_command(cat)", |
| 114 | + "run_shell_command(echo)", |
| 115 | + "run_shell_command(grep)", |
| 116 | + "run_shell_command(head)", |
| 117 | + "run_shell_command(tail)" |
| 118 | + ] |
| 119 | + } |
| 120 | + } |
| 121 | + prompt: '/gemini-plan-execute' |
0 commit comments