|
| 1 | +name: '🧙 Gemini Issue Fixer' |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + |
| 6 | +concurrency: |
| 7 | + group: '${{ github.workflow }}-${{ github.head_ref || github.ref }}-${{ github.event.issue.number }}' |
| 8 | + cancel-in-progress: true |
| 9 | + |
| 10 | +defaults: |
| 11 | + run: |
| 12 | + shell: 'bash' |
| 13 | + |
| 14 | +jobs: |
| 15 | + create-pr: |
| 16 | + timeout-minutes: 30 |
| 17 | + runs-on: 'ubuntu-latest' |
| 18 | + permissions: |
| 19 | + contents: 'write' # Enable reading and modifying code |
| 20 | + id-token: 'write' # Enable minting an identity token |
| 21 | + issues: 'write' # Enable updating issues, such as posting a comment |
| 22 | + pull-requests: 'write' # Enable creating pull requests |
| 23 | + |
| 24 | + steps: |
| 25 | + # Mint a token so that the comments show up as gemini-cli instead of github-actions. |
| 26 | + - name: 'Mint identity token' |
| 27 | + id: 'mint_identity_token' |
| 28 | + if: |- |
| 29 | + ${{ vars.APP_ID }} |
| 30 | + uses: 'actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf' # ratchet:actions/create-github-app-token@v2 |
| 31 | + with: |
| 32 | + app-id: '${{ vars.APP_ID }}' |
| 33 | + private-key: '${{ secrets.APP_PRIVATE_KEY }}' |
| 34 | + permission-contents: 'write' |
| 35 | + permission-issues: 'write' |
| 36 | + permission-pull-requests: 'write' |
| 37 | + |
| 38 | + - name: 'Checkout repository' |
| 39 | + uses: 'actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8' # ratchet:actions/checkout@v6 |
| 40 | + |
| 41 | + - name: 'Run Gemini PR Create' |
| 42 | + uses: 'google-github-actions/run-gemini-cli@main' # ratchet:exclude |
| 43 | + id: 'gemini_pr_create' |
| 44 | + env: |
| 45 | + GITHUB_TOKEN: '${{ steps.mint_identity_token.outputs.token || secrets.GITHUB_TOKEN }}' |
| 46 | + REPOSITORY: '${{ github.repository }}' |
| 47 | + ISSUE_NUMBER: '${{ github.event.issue.number }}' |
| 48 | + ISSUE_TITLE: '${{ github.event.issue.title }}' |
| 49 | + ISSUE_BODY: '${{ github.event.issue.body }}' |
| 50 | + BRANCH_NAME: 'gemini-fix-${{ github.event.issue.number }}' |
| 51 | + EVENT_NAME: '${{ github.event_name }}' |
| 52 | + TRIGGERING_ACTOR: '${{ github.triggering_actor }}' |
| 53 | + with: |
| 54 | + gcp_location: '${{ vars.GOOGLE_CLOUD_LOCATION }}' |
| 55 | + gcp_project_id: '${{ vars.GOOGLE_CLOUD_PROJECT }}' |
| 56 | + gcp_service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}' |
| 57 | + gcp_workload_identity_provider: '${{ vars.GCP_WIF_PROVIDER }}' |
| 58 | + gemini_api_key: '${{ secrets.GEMINI_API_KEY }}' |
| 59 | + gemini_cli_version: '${{ vars.GEMINI_CLI_VERSION }}' |
| 60 | + gemini_debug: '${{ fromJSON(vars.GEMINI_DEBUG || vars.ACTIONS_STEP_DEBUG || false) }}' |
| 61 | + gemini_model: '${{ vars.GEMINI_MODEL }}' |
| 62 | + google_api_key: '${{ secrets.GOOGLE_API_KEY }}' |
| 63 | + use_gemini_code_assist: '${{ vars.GOOGLE_GENAI_USE_GCA }}' |
| 64 | + use_vertex_ai: '${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}' |
| 65 | + upload_artifacts: '${{ vars.UPLOAD_ARTIFACTS }}' |
| 66 | + settings: |- |
| 67 | + { |
| 68 | + "debug": ${{ fromJSON(vars.GEMINI_DEBUG || vars.ACTIONS_STEP_DEBUG || false) }}, |
| 69 | + "model": { |
| 70 | + "maxSessionTurns": 200 |
| 71 | + }, |
| 72 | + "mcpServers": { |
| 73 | + "github": { |
| 74 | + "command": "docker", |
| 75 | + "args": [ |
| 76 | + "run", |
| 77 | + "-i", |
| 78 | + "--rm", |
| 79 | + "-e", |
| 80 | + "GITHUB_PERSONAL_ACCESS_TOKEN", |
| 81 | + "ghcr.io/github/github-mcp-server:v0.27.0" |
| 82 | + ], |
| 83 | + "env": { |
| 84 | + "GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}" |
| 85 | + } |
| 86 | + } |
| 87 | + }, |
| 88 | + "telemetry": { |
| 89 | + "enabled": true, |
| 90 | + "target": "local", |
| 91 | + "outfile": ".gemini/telemetry.log" |
| 92 | + } |
| 93 | + } |
| 94 | + prompt: '/gemini-issue-fixer' |
0 commit comments