Skip to content

Conversation

@jerop
Copy link
Contributor

@jerop jerop commented Jul 16, 2025

This commit introduces the core implementation of the Gemini CLI GitHub Action, establishing its primary features and structure.

Key features:

  • Composite Action: The action is built as a composite action, directly installing and running the Gemini CLI for efficiency and simplicity.
  • Workflows: Includes example workflows for key use cases:
    • Automated and scheduled issue triage.
    • Pull request reviews.
  • Documentation: Comprehensive documentation is added for:
    • Configuration and setup.
    • Authentication using GitHub Apps and Google Cloud Workload Identity Federation.
    • Observability with OpenTelemetry.
  • Scripts: Helper scripts are provided to facilitate the setup of Workload Identity and OpenTelemetry.
  • Project Files:
    • action.yml is configured with inputs for the CLI.
    • README.md, CONTRIBUTING.md, and GEMINI.md provide usage and contribution guidelines.

@jerop jerop requested review from a team as code owners July 16, 2025 21:46
@jerop jerop requested review from sethvargo and verbanicm July 16, 2025 21:46
@jerop jerop force-pushed the feature/init branch 4 times, most recently from 60d82cc to f441560 Compare July 16, 2025 22:56
@sethvargo sethvargo requested a review from bradegler July 16, 2025 23:00
@sethvargo
Copy link
Contributor

@bradegler as the resident bash wizard, can you take a pass on this please?

@jerop jerop force-pushed the feature/init branch 17 times, most recently from 7103670 to 728be25 Compare July 17, 2025 12:17
@jerop jerop changed the title feat: add documentation, workflows, and issue templates for Gemini CLI on GitHub feat: Initial implementation of the Gemini CLI GitHub Action Jul 17, 2025
This commit introduces the core implementation of the Gemini CLI GitHub Action, establishing its primary features and structure.

Key features and additions include:

- **Composite Action:** The action is built as a composite action, directly installing and running the Gemini CLI for efficiency and simplicity.
- **Workflows:** Includes example workflows for key use cases:
  - Automated and scheduled issue triage.
  - Pull request reviews.
- **Documentation:** Comprehensive documentation is added for:
  - Configuration and setup.
  - Authentication using GitHub Apps and Google Cloud Workload Identity Federation.
  - Observability with OpenTelemetry.
- **Scripts:** Helper scripts are provided to facilitate the setup of Workload Identity and OpenTelemetry.
- **Project Files:**
  - `action.yml` is configured with inputs for the CLI.
  - `README.md`, `CONTRIBUTING.md`, and `GEMINI.md` provide usage and contribution guidelines.
@jerop jerop linked an issue Jul 17, 2025 that may be closed by this pull request
Copy link

@bradegler bradegler left a comment

Choose a reason for hiding this comment

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

The bash contained in this PR looks good.

@sethvargo sethvargo merged commit 3c7f943 into main Jul 17, 2025
6 checks passed
@sethvargo sethvargo deleted the feature/init branch July 17, 2025 18:20
Copy link
Contributor

@gemini-cli gemini-cli bot left a comment

Choose a reason for hiding this comment

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

📋 Review Summary

This pull request introduces the initial implementation of the run-gemini-cli GitHub Action. The action is well-structured as a composite action and includes comprehensive documentation and example workflows for common use cases like issue triage and pull request reviews.

🔍 General Feedback

  • The use of composite actions is a good choice for performance and simplicity.
  • The documentation is well-written and provides clear instructions for users.
  • The example workflows are very helpful for getting started with the action.
  • The telemetry and observability features are a great addition.
  • The most critical issue is the removal of tests for the action. Without tests, it is difficult to ensure the correctness and stability of the action.

}

try {
return JSON.parse(content);
Copy link
Contributor

Choose a reason for hiding this comment

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

🟡 The getJson, downloadFile, and ensureBinary functions use shell commands like curl, unzip, and tar directly. While this works in the GitHub Actions environment, it would be more robust and platform-independent to use Node.js libraries for these tasks, such as node-fetch for downloading and tar or decompress for extraction. This would also improve error handling.

Copy link
Contributor

@gemini-cli gemini-cli bot left a comment

Choose a reason for hiding this comment

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

📋 Review Summary

This is an excellent pull request that refactors the action to be a composite action. This change simplifies the codebase and improves maintainability. The addition of comprehensive documentation, examples, and helper scripts for setup is a huge improvement for the user experience.

🔍 General Feedback

  • The move to a composite action is a great decision.
  • The new documentation is clear and comprehensive.
  • The example workflows are very helpful for users.

I have only a few minor suggestions for improvement, which I have added as comments.

Copy link
Contributor

@gemini-cli gemini-cli bot left a comment

Choose a reason for hiding this comment

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

## 📋 Review Summary
This pull request introduces a comprehensive set of workflows and documentation for the Gemini CLI GitHub Action. The changes are well-structured and provide a solid foundation for the project. The review includes some suggestions to improve the robustness and maintainability of the action and its workflows.

## 🔍 General Feedback

- The use of composite actions is a great choice for this project, making it lightweight and fast.
- The documentation is clear and provides good examples for users to get started.
- The workflows for issue triage and pull request review are well-designed and will be very useful.
</SUMMARY>

VERSION_INPUT="${GEMINI_CLI_VERSION:-latest}"
if [[ "$VERSION_INPUT" == "latest" || "$VERSION_INPUT" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9\.-]+)?(\+[a-zA-Z0-9\.-]+)?$ ]]; then
echo "Installing Gemini CLI from npm: @google/gemini-cli@$VERSION_INPUT"
Copy link
Contributor

Choose a reason for hiding this comment

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

🟢 The `--yolo` flag bypasses all safety checks and should not be used in a production workflow. It's better to be explicit about the tools and commands that are allowed to run.
    ```suggestion
            gemini --prompt "${PROMPT}"
    ```
    </COMMENT>

echo "pr_data=${PR_DATA}" >> "${GITHUB_OUTPUT}"
# Get file changes
CHANGED_FILES="$(gh pr diff "${PR_NUMBER}" --name-only)"
Copy link
Contributor

Choose a reason for hiding this comment

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

🟡 Using a composite action with `uses: './'` can be confusing and makes it harder to track which version of the action is being used. It is better to use a versioned reference to the action, like `uses: google-github-actions/run-gemini-cli@main` or `uses: google-github-actions/run-gemini-cli@v1`.
    ```suggestion
          uses: 'google-github-actions/run-gemini-cli@main'
    ```
    </COMMENT>

using: 'composite'
steps:
- name: 'Configure Gemini CLI'
if: |-
Copy link
Contributor

Choose a reason for hiding this comment

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

🟡 The `google-github-actions/auth@v2` action is outdated. Please use the latest version of the action to ensure you have the latest features and security updates.
    ```suggestion
          uses: 'google-github-actions/auth@v3'
    ```
    </COMMENT>

workflow_dispatch:
inputs:
pr_number:
description: 'PR number to review'
Copy link
Contributor

Choose a reason for hiding this comment

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

🟢 To avoid canceling unrelated workflows, it's a good practice to make the concurrency group more specific by including the workflow name and event name.
    ```suggestion
      group: '${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }}'
    ```
    </COMMENT>

fileExists,
waitForPort,
ensureBinary,
} from './telemetry_utils.js';
Copy link
Contributor

Choose a reason for hiding this comment

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

🟢 Hardcoding the configuration in a script makes it difficult to manage and update. It's better to use a separate template file for the configuration and load it in the script.

console.log('🧹 Cleaning up old processes and logs...');
try {
execSync('pkill -f "otelcol-contrib"');
console.log('✅ Stopped existing collector process.');
Copy link
Contributor

Choose a reason for hiding this comment

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

🟡 `pkill -f` can be dangerous as it might terminate unintended processes. It's better to store the process ID (PID) of the collector process when it's started and then use that PID to kill the specific process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Implement the Initial Version of the Gemini CLI GitHub Action

3 participants