Skip to content

feat(ci): add Gemini auto review and invoke workflows - #5679

Closed
DeanChensj wants to merge 4 commits into
google:mainfrom
DeanChensj:main
Closed

feat(ci): add Gemini auto review and invoke workflows#5679
DeanChensj wants to merge 4 commits into
google:mainfrom
DeanChensj:main

Conversation

@DeanChensj

Copy link
Copy Markdown
Collaborator

Same config as in adk-python-community

@sasha-gitgsasha-gitg left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

This PR introduces three new GitHub Actions workflows (gemini-dispatch.yml, gemini-invoke.yml, and gemini-review.yml) to integrate Gemini CLI for automated PR reviews and issue interactions. Overall, the structure is clean, but there is a critical logic flaw in the dispatch workflow and a few configuration improvements needed.

Review Comments

  1. .github/workflows/gemini-dispatch.yml (Lines +16-19, +101-114)

    • Issue: The pull_request trigger includes ready_for_review. However, in the Extract command step, eventType === 'pull_request.opened' is checked, but pull_request.ready_for_review is not handled. This causes ready_for_review events to fall through to command = 'fallthrough'. Consequently, the fallthrough job runs and posts a failure comment ("🤖 I'm sorry @Actor, but I was unable to process your request.") whenever a draft PR is marked as ready for review.
    • Why: Potential Bug / Logic Error. Users will receive false-positive failure notifications when marking PRs ready for review.
    • Fix: Update the condition to handle ready_for_review:
      if(eventType==='pull_request.opened'||eventType==='pull_request.ready_for_review'){core.setOutput('command','review');}
    • Severity: Critical
  2. .github/workflows/gemini-invoke.yml (Lines +304-305) & .github/workflows/gemini-review.yml (Lines +418-419)

    • Issue: In the settings JSON block, GITHUB_PERSONAL_ACCESS_TOKEN is configured as "${GITHUB_TOKEN}".
    • Why: Potential Bug / Best Practice. If run-gemini-cli does not perform environment variable expansion within the JSON payload before passing it to the docker container, the container will receive the literal string "${GITHUB_TOKEN}" rather than the actual token.
    • Fix: Use GitHub Actions expression syntax to interpolate the token directly into the JSON string, or verify that run-gemini-cli explicitly expands environment variables in settings:
      "env": {
      "GITHUB_PERSONAL_ACCESS_TOKEN": "${{ env.GITHUB_TOKEN }}"
      }
    • Severity: Major
  3. .github/workflows/gemini-review.yml (Lines +406-421)

    • Issue: The mcpServers.github block omits includeTools. In contrast, gemini-invoke.yml explicitly restricts tools using includeTools.
    • Why: Security / Least Privilege. Omitting includeTools exposes all available tools from github-mcp-server to the model during PR reviews. Although workflow permissions are scoped, adhering to least privilege is best practice.
    • Fix: Explicitly restrict includeTools to the specific tools required by the review prompt:
      "includeTools": [
      "pull_request_read",
      "add_comment_to_pending_review",
      "pull_request_review_write"
      ]
    • Severity: Suggestion

@DeanChensj

Copy link
Copy Markdown
CollaboratorAuthor

Addressed your comments, thanks @sasha-gitg

@DeanChensjDeanChensj added the ready to pull [Status] This PR is ready to be imported back to Google label May 13, 2026
copybara-serviceBot pushed a commit that referenced this pull request May 13, 2026
Merge #5679
Same config as in adk-python-community
COPYBARA_INTEGRATE_REVIEW=#5679 from DeanChensj:main d33c368
PiperOrigin-RevId: 914634367
@adk-bot

Copy link
Copy Markdown
Collaborator

Thank you @DeanChensj for your contribution! 🎉

Your changes have been successfully imported and merged via Copybara in commit fd8b492.

Closing this PR as the changes are now in the main branch.

@adk-botadk-bot closed this May 13, 2026
loic-combis pushed a commit to loic-combis/adk-python that referenced this pull request May 14, 2026
Merge google#5679
Same config as in adk-python-community
COPYBARA_INTEGRATE_REVIEW=google#5679 from DeanChensj:main d33c368
PiperOrigin-RevId: 914634367
FrigaZzz pushed a commit to FrigaZzz/adk-python that referenced this pull request Aug 11, 2026
Merge google#5679
Same config as in adk-python-community
COPYBARA_INTEGRATE_REVIEW=google#5679 from DeanChensj:main d33c368
PiperOrigin-RevId: 914634367
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to pull[Status] This PR is ready to be imported back to Google

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@DeanChensj@adk-bot@sasha-gitg@GWeale