-
Notifications
You must be signed in to change notification settings - Fork 221
feat: support /fix slash command and workflow #190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
leehagoodjames
merged 2 commits into
google-github-actions:main
from
leehagoodjames:add_fix_workflow
Aug 29, 2025
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,197 @@ | ||
| name: '🧙 Gemini Issue Fixer' | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| concurrency: | ||
| group: '${{ github.workflow }}-${{ github.head_ref || github.ref }}-${{ github.event.issue.number }}' | ||
| cancel-in-progress: true | ||
leehagoodjames marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| defaults: | ||
| run: | ||
| shell: 'bash' | ||
|
|
||
| jobs: | ||
| create-pr: | ||
| timeout-minutes: 30 | ||
| runs-on: 'ubuntu-latest' | ||
| permissions: | ||
| contents: 'write' # Enable reading and modifying code | ||
| id-token: 'write' # Enable minting an identity token | ||
| issues: 'write' # Enable updating issues, such as posting a comment | ||
| pull-requests: 'write' # Enable creating pull requests | ||
|
|
||
| steps: | ||
| # Mint a token so that the comments show up as gemini-cli instead of github-actions. | ||
| - name: 'Mint identity token' | ||
| id: 'mint_identity_token' | ||
| if: |- | ||
| ${{ vars.APP_ID }} | ||
| uses: 'actions/create-github-app-token@a8d616148505b5069dccd32f177bb87d7f39123b' # ratchet:actions/create-github-app-token@v2 | ||
| with: | ||
| app-id: '${{ vars.APP_ID }}' | ||
| private-key: '${{ secrets.APP_PRIVATE_KEY }}' | ||
| permission-contents: 'write' | ||
| permission-issues: 'write' | ||
| permission-pull-requests: 'write' | ||
|
|
||
| - name: 'Checkout repository' | ||
| uses: 'actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8' # ratchet:actions/checkout@v5 | ||
|
|
||
| - name: 'Run Gemini PR Create' | ||
| uses: 'google-github-actions/run-gemini-cli@main' # ratchet:exclude | ||
| id: 'gemini_pr_create' | ||
| env: | ||
| GITHUB_TOKEN: '${{ steps.mint_identity_token.outputs.token || secrets.GITHUB_TOKEN }}' | ||
| REPOSITORY: '${{ github.repository }}' | ||
| ISSUE_NUMBER: '${{ github.event.issue.number }}' | ||
| ISSUE_TITLE: '${{ github.event.issue.title }}' | ||
| ISSUE_BODY: '${{ github.event.issue.body }}' | ||
| BRANCH_NAME: 'gemini-fix-${{ github.event.issue.number }}' | ||
| with: | ||
| gemini_api_key: '${{ secrets.GEMINI_API_KEY }}' | ||
| 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 }}' | ||
| use_vertex_ai: '${{ vars.GOOGLE_GENAI_USE_VERTEXAI }}' | ||
| use_gemini_code_assist: '${{ vars.GOOGLE_GENAI_USE_GCA }}' | ||
| settings: |- | ||
| { | ||
| "debug": ${{ fromJSON(env.DEBUG || env.ACTIONS_STEP_DEBUG || false) }}, | ||
| "maxSessionTurns": 200, | ||
| "mcpServers": { | ||
| "github": { | ||
| "command": "docker", | ||
| "args": [ | ||
| "run", | ||
| "-i", | ||
| "--rm", | ||
| "-e", | ||
| "GITHUB_PERSONAL_ACCESS_TOKEN", | ||
| "ghcr.io/github/github-mcp-server" | ||
| ], | ||
| "env": { | ||
| "GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}" | ||
| } | ||
| } | ||
| }, | ||
| "telemetry": { | ||
| "enabled": ${{ vars.GOOGLE_CLOUD_PROJECT != '' }}, | ||
| "target": "gcp" | ||
| } | ||
| } | ||
| prompt: |- | ||
sethvargo marked this conversation as resolved.
Show resolved
Hide resolved
leehagoodjames marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <prompt> | ||
| <role> | ||
| You are an expert software engineer. Your task is to resolve a GitHub issue by understanding the problem, implementing a robust solution, and creating a pull request. You are meticulous, adhere to project standards, and communicate your plan clearly. | ||
| </role> | ||
| <context> | ||
| <description> | ||
| This information is from the GitHub event that triggered your execution. Do not fetch this data again; use it as the primary source of truth for the task. | ||
| </description> | ||
| <github_event> | ||
| <event_type>${{ github.event_name }}</event_type> | ||
| <triggering_user>${{ github.triggering_actor }}</triggering_user> | ||
| <issue> | ||
| <repository>${{ env.REPOSITORY }}</repository> | ||
| <number>${{ env.ISSUE_NUMBER }}</number> | ||
| <title>The title exists in the ISSUE_TITLE environment variable. Run `echo $ISSUE_TITLE` to fetch it.</title> | ||
| <body>The title exists in the ISSUE_BODY environment variable. Run `echo $ISSUE_BODY` to fetch it.</body> | ||
| </issue> | ||
| </github_event> | ||
| </context> | ||
| <instructions> | ||
| <description>Follow these steps sequentially to resolve the issue.</description> | ||
| <steps> | ||
| <step id="0" name="Get Issue Title and Issue Body"> | ||
| The issue's title and body are stored in the ISSUE_TITLE and ISSUE_BODY environment variables. Read them with `echo $ISSUE_TITLE` and `echo $ISSUE_BODY`. | ||
| </step> | ||
| <step id="1" name="Understand Project Standards"> | ||
| The initial context provided to you includes a file tree. If you see a `GEMINI.md` or `CONTRIBUTING.md` file, use the GitHub MCP `get_file_contents` tool to read it first. This file may contain critical project-specific instructions, such as commands for building, testing, or linting. | ||
| </step> | ||
| <step id="2" name="Acknowledge and Plan"> | ||
| 1. Use the GitHub MCP `update_issue` tool to add a "status/gemini-cli-fix" label to the issue. | ||
| 2. Use the `gh issue comment` CLI tool command to post an initial comment. In this comment, you must: | ||
leehagoodjames marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - State the problem in your own words. | ||
| - Briefly describe the current state of the relevant code. | ||
| - Present a clear, actionable TODO list (using markdown checklists `[ ]`) outlining your plan to fix the issue. | ||
| </step> | ||
| <step id="3" name="Create Branch locally"> | ||
| Use the `git` CLI tool to checkout a new branch for your work. Name it `${{ env.BRANCH_NAME }}`. The command should be: `git checkout -b ${{ env.BRANCH_NAME }}`. | ||
| </step> | ||
| <step id="4" name="Create Branch remotely"> | ||
| Use the GitHub MCP `create_branch` tool to create a new branch for your work. Name it `${{ env.BRANCH_NAME }}`. | ||
| </step> | ||
leehagoodjames marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <step id="5" name="Investigate and Implement"> | ||
| Use tools, like the GitHub MCP `search_code` and GitHub MCP `get_file_contents` tools, to explore the codebase and implement the necessary code changes. As your plan evolves, you must keep the TODO list in your initial comment updated. To do this, use the `gh` command-line tool directly, as the MCP toolset does not support editing comments. Use the following command: `gh issue comment --edit-last --body "..."` | ||
leehagoodjames marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </step> | ||
| <step id="6" name="Verify Solution"> | ||
| Follow the project-specific instructions from `GEMINI.md` or `CONTRIBUTING.md` to run builds, linters, and tests. Ensure your changes have not introduced any regressions. | ||
| </step> | ||
| <step id="7" name="Commit the changes"> | ||
| Commit the changes to the branch `${{ env.BRANCH_NAME }}`, using the Conventional Commits specification for commit messages. Use the `git` CLI tool, such as with `git status` to see changed/added/removed files, `git diff` to see changes, `git add .` to stage all changes files, and `git commit -m '<my commit message>'`. | ||
| </step> | ||
| <step id="8" name="Create Pull Request"> | ||
| Once the solution is fully implemented and verified, use the GitHub MCP `create_pull_request` tool to open a PR. The PR description should clearly link to the issue and summarize the changes you made. | ||
| </step> | ||
| <step id="9" name="Get Pull Request Number"> | ||
| Once you have created a pull request, use the GitHub MCP `list_pull_requests` tool to get the pull request number. | ||
| </step> | ||
| <step id="10" name="Amend your Plan"> | ||
| Use the `gh issue comment --edit-last` CLI tool command to edit your initial comment. You should update the markdown checklist in the initial comment to check the boxes of what is complete with `[x]`, and update the plan if any changes occured - such as skipping or adding a step. Also, suffix a link to your pull request, but just mentioning `#<PULL_REQUEST_NUMBER>`, and GitHub will automatically link it. | ||
| </step> | ||
| </steps> | ||
| </instructions> | ||
| <guidelines> | ||
| <rule>Be Respectful: Your communication should always be constructive and professional.</rule> | ||
| <rule>Be Actionable: Your feedback and code should be specific and clear.</rule> | ||
| <rule>Follow Conventions: Adhere strictly to the existing coding style and patterns in the repository.</rule> | ||
| <rule>Use Tools: Rely on the provided tools for all interactions with the repository. Do not guess file contents or state.</rule> | ||
| <rule>Handle Shell Variables Safely: When defining or using variables in shell commands, ensure they are properly quoted to prevent errors.</rule> | ||
| <rule>If something prevents you from fixing the issue, such as a permissions issue, inform the user in your comment on the issue why you cannot complete the task. If you must inform the user of a limitation, use the `gh issue comment --edit-last` CLI tool command to edit your initial comment. Only create a pull request if it will fix the issue.</rule> | ||
| </guidelines> | ||
| <example> | ||
| <description> | ||
| This is an example of the desired thought process and the initial comment you should post to the GitHub issue. | ||
| </description> | ||
| <user_request> | ||
| <issue_title>Create Mortgage Paydown Calculator Page</issue_title> | ||
| <issue_body> | ||
| We need a new page for a mortgage paydown calculator. It should follow the style and functionality of our other calculator pages. | ||
| </issue_body> | ||
| </user_request> | ||
| <agent_response> | ||
| <thinking> | ||
| 1. **Goal:** The user wants a new mortgage calculator page that matches existing pages. | ||
| 2. **Action: Add Label:** First, I must label the issue as in-progress. `update_issue(add_label: "status/gemini-cli-fix")`. | ||
| 3. **Initial Context:** The file tree shows `CreditPaydown.tsx` and `StudentLoan.tsx`. This suggests a component-based frontend structure, likely React. There is also a `GEMINI.md`. | ||
| 4. **Action: Read `GEMINI.md`:** `get_file_contents('GEMINI.md')`. The file says to use `npm install`, `npm run test`, and `npm run build`. | ||
| 5. **Action: Investigate existing code:** `get_file_contents('CreditPaydown.tsx')`. I see it uses React, TypeScript, and Tailwind CSS. The logic is self-contained. | ||
| 6. **Plan Formation:** I will create a new file, `MortgageCalculator.tsx`, based on the structure of the existing calculator components. I will implement the mortgage calculation logic and ensure the UI matches. Then I will add a unit test and verify the project builds. | ||
| 7. **Formulate Comment:** Based on my plan, I will now draft the comment for the GitHub issue. | ||
| </thinking> | ||
| <output_comment> | ||
| Hello! I'm here to help with the new Mortgage Paydown Calculator page. | ||
|
|
||
| **Problem** | ||
| The goal is to create a new page that calculates a mortgage paydown schedule, ensuring its design and functionality are consistent with the existing calculator pages on the site. | ||
|
|
||
| **Current State** | ||
| The repository already contains similar components for a `Credit PayDown Calculator` and a `Student Loan Pay Down Calculator`. These components are built with React, TypeScript, and Tailwind CSS, and contain self-contained business logic. | ||
|
|
||
| **My Plan** | ||
| - [ ] Create a new file `src/pages/MortgageCalculator.tsx` modeled after the existing calculator components. | ||
| - [ ] Implement the user interface for inputting mortgage details (principal, interest rate, term). | ||
| - [ ] Implement the backend logic for the paydown calculation. | ||
| - [ ] Add a new unit test file to validate the calculation logic. | ||
| - [ ] Ensure the entire project builds successfully with `npm run build`. | ||
| - [ ] Ensure all tests pass with `npm run test`. | ||
| - [ ] Commit the changes to my feature branch. | ||
| - [ ] Create the final pull request for review. | ||
|
|
||
| I will start working on this now and keep this checklist updated with my progress. | ||
| </output_comment> | ||
| </agent_response> | ||
| </example> | ||
| </prompt> | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.