diff --git a/.github/workflows/gemini-dispatch.yml b/.github/workflows/gemini-dispatch.yml index 9f74a7dd9..883664135 100644 --- a/.github/workflows/gemini-dispatch.yml +++ b/.github/workflows/gemini-dispatch.yml @@ -25,7 +25,7 @@ defaults: jobs: debugger: if: |- - ${{ fromJSON(vars.DEBUG || vars.ACTIONS_STEP_DEBUG || false) }} + ${{ fromJSON(vars.DEBUG || vars.ACTIONS_STEP_DEBUG || false) }} runs-on: 'ubuntu-latest' permissions: contents: 'read' diff --git a/.github/workflows/gemini-issue-fixer.yml b/.github/workflows/gemini-issue-fixer.yml index 0d6aefee7..8ecb758ae 100644 --- a/.github/workflows/gemini-issue-fixer.yml +++ b/.github/workflows/gemini-issue-fixer.yml @@ -16,9 +16,9 @@ jobs: 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 + 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: diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 000000000..b0a86fd13 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,9 @@ +npx lint-staged || { + echo '' + echo '====================================================' + echo 'pre-commit checks failed. in case of emergency, run:' + echo '' + echo 'git commit --no-verify' + echo '====================================================' + exit 1 +} \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..d1d4fdda6 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,17 @@ +**/bundle +**/coverage +**/dist +**/.git +**/node_modules +.docker +.DS_Store +.env +.gemini/ +.idea +.integration-tests/ +*.iml +*.tsbuildinfo +*.vsix +**/generated +junit.xml +Thumbs.db diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 000000000..fa9699b89 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "semi": true, + "trailingComma": "all", + "singleQuote": true, + "printWidth": 80, + "tabWidth": 2 +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 529a0308f..913adfbd3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -54,64 +54,65 @@ Before contributing, ensure you have: ## Contribution Workflow 1. **Create a Branch** - - Create a new branch for your changes. Use a descriptive name: - ```sh - git checkout -b feature/your-descriptive-branch-name - ``` + - Create a new branch for your changes. Use a descriptive name: + ```sh + git checkout -b feature/your-descriptive-branch-name + ``` 2. **Make Your Changes** - - Implement your changes following the [development guidelines](#development-guidelines) - - If you modify `action.yml` inputs or outputs, update the documentation: - ```sh - npm run docs - ``` - - If you update workflow files in `/.gemini/workflows/`, run `./scripts/generate-examples.sh` to auto-generate the examples. + - Implement your changes following the [development guidelines](#development-guidelines) + - If you modify `action.yml` inputs or outputs, update the documentation: + ```sh + npm run docs + ``` + - If you update workflow files in `/.gemini/workflows/`, run `./scripts/generate-examples.sh` to auto-generate the examples. 3. **Commit Your Changes** - - Commit with a descriptive message following [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) - - **Example of a detailed commit message:** - ```sh - git commit -m "feat: add custom timeout support for workflow execution - - Users reported workflow failures in large repositories where Gemini CLI - operations exceed the default GitHub Actions timeout limit. This causes - incomplete analysis and frustrating failures for complex codebases. - - Add configurable timeout support to prevent workflow timeouts: - - Enable users to set custom timeout values based on repository size - - Provide graceful handling when operations approach time limits - - Include clear error messages when timeouts occur - - Document timeout configuration for different use cases - - This resolves timeout issues for enterprise users with large repositories - and improves the overall reliability of the action. - - Closes #123" - ``` + - Commit with a descriptive message following [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) + + **Example of a detailed commit message:** + + ```sh + git commit -m "feat: add custom timeout support for workflow execution + + Users reported workflow failures in large repositories where Gemini CLI + operations exceed the default GitHub Actions timeout limit. This causes + incomplete analysis and frustrating failures for complex codebases. + + Add configurable timeout support to prevent workflow timeouts: + - Enable users to set custom timeout values based on repository size + - Provide graceful handling when operations approach time limits + - Include clear error messages when timeouts occur + - Document timeout configuration for different use cases + + This resolves timeout issues for enterprise users with large repositories + and improves the overall reliability of the action. + + Closes #123" + ``` 4. **Keep Your Fork Synced** - - Sync your `main` branch with the `upstream` repository: - ```sh - git checkout main - git pull upstream main - ``` + - Sync your `main` branch with the `upstream` repository: + ```sh + git checkout main + git pull upstream main + ``` 5. **Rebase Your Branch** - - Rebase your feature branch on top of the latest `main`: - ```sh - git checkout feature/your-descriptive-branch-name - git rebase main - ``` + - Rebase your feature branch on top of the latest `main`: + ```sh + git checkout feature/your-descriptive-branch-name + git rebase main + ``` 6. **Push Your Changes** - - Push your changes to your forked repository: - ```sh - git push --force-with-lease origin feature/your-descriptive-branch-name - ``` + - Push your changes to your forked repository: + ```sh + git push --force-with-lease origin feature/your-descriptive-branch-name + ``` 7. **Create a Pull Request** - - Go to your forked repository on GitHub and create a pull request + - Go to your forked repository on GitHub and create a pull request ## Development Guidelines @@ -122,17 +123,20 @@ When contributing to this composite GitHub Action: Follow these principles when contributing to this composite GitHub Action: #### Security + - **Principle of least privilege**: Request only necessary permissions - **Validate inputs**: Sanitize user inputs to prevent security issues - **Secure defaults**: Choose the most secure configuration options #### Code Quality + - **Clear naming**: Use descriptive variable and function names - **Error handling**: Provide meaningful error messages with context - **Shell best practices**: Write portable, robust shell scripts - **Documentation**: Keep code and documentation synchronized #### Action Standards + - **YAML consistency**: Use consistent formatting and structure - **Input/output documentation**: Clearly describe all parameters - **Version management**: Pin dependencies to specific versions @@ -141,10 +145,10 @@ Follow these principles when contributing to this composite GitHub Action: Before submitting your PR: -- **Validate action.yml**: Ensure the manifest is valid YAML -- **Test workflows**: Verify example workflows work as expected -- **Check documentation**: Ensure all examples and references are accurate -- **Lint shell scripts**: Use tools like `shellcheck` for script validation +- **Validate action.yml**: Ensure the manifest is valid YAML +- **Test workflows**: Verify example workflows work as expected +- **Check documentation**: Ensure all examples and references are accurate +- **Lint shell scripts**: Use tools like `shellcheck` for script validation ## Documentation @@ -161,6 +165,7 @@ When making changes: The inputs and outputs documentation in `README.md` is automatically generated from `action.yml`. After modifying `action.yml`: 1. Run the documentation update script: + ```sh npm run docs ``` diff --git a/GEMINI.md b/GEMINI.md index e69bd00dd..161ffeec0 100644 --- a/GEMINI.md +++ b/GEMINI.md @@ -7,27 +7,27 @@ Your primary goal is to ensure that any changes you make adhere to the best prac ### Core Principles for This Action 1. **Understand the `action.yml` Manifest:** - * This is the heart of the action. It defines inputs, outputs, branding, and the execution steps. - * When adding or modifying functionality, ensure the `action.yml` is updated clearly and correctly. - * Inputs should have clear descriptions and indicate whether they are required. + - This is the heart of the action. It defines inputs, outputs, branding, and the execution steps. + - When adding or modifying functionality, ensure the `action.yml` is updated clearly and correctly. + - Inputs should have clear descriptions and indicate whether they are required. 2. **Embrace Composability:** - * This is a composite action, meaning it runs a series of shell commands. This makes it lightweight and fast. - * Prefer using standard, portable shell commands (`sh`) to ensure compatibility across different runners. - * Avoid introducing complex dependencies that would require a containerized action unless absolutely necessary. + - This is a composite action, meaning it runs a series of shell commands. This makes it lightweight and fast. + - Prefer using standard, portable shell commands (`sh`) to ensure compatibility across different runners. + - Avoid introducing complex dependencies that would require a containerized action unless absolutely necessary. 3. **Security is Paramount:** - * **Never expose secrets.** Set required tokens and keys as environment variables using `secrets` in your workflows. - * **Principle of Least Privilege:** When documenting required permissions for the action (in the `README.md`), always recommend the minimum set of permissions necessary for the action to function. + - **Never expose secrets.** Set required tokens and keys as environment variables using `secrets` in your workflows. + - **Principle of Least Privilege:** When documenting required permissions for the action (in the `README.md`), always recommend the minimum set of permissions necessary for the action to function. 4. **Prioritize User Experience:** - * **Clear Documentation:** The `README.md` is our user manual. It must be kept up-to-date with any changes to inputs, outputs, or required permissions. Usage examples are critical. - * **Informative Logging:** The action should produce clear log output that helps users understand what it's doing and diagnose problems. - * **Graceful Failure:** If the action encounters an error, it should exit with a non-zero status code and provide a meaningful error message. + - **Clear Documentation:** The `README.md` is our user manual. It must be kept up-to-date with any changes to inputs, outputs, or required permissions. Usage examples are critical. + - **Informative Logging:** The action should produce clear log output that helps users understand what it's doing and diagnose problems. + - **Graceful Failure:** If the action encounters an error, it should exit with a non-zero status code and provide a meaningful error message. 5. **Maintain Workflow Examples:** - * The files in the `/examples` directory are crucial for demonstrating how to use this action. - * Ensure they are kept in sync with the latest features and best practices. + - The files in the `/examples` directory are crucial for demonstrating how to use this action. + - Ensure they are kept in sync with the latest features and best practices. ### Your Role in Development diff --git a/README.md b/README.md index 7247f2741..ddd3cfccd 100644 --- a/README.md +++ b/README.md @@ -150,8 +150,8 @@ go to the [Gemini Assistant workflow documentation](./examples/workflows/gemini- ### Inputs + - - gcp_location: _(Optional)_ The Google Cloud location. - gcp_project_id: _(Optional)_ The Google Cloud project ID. @@ -193,35 +193,35 @@ go to the [Gemini Assistant workflow documentation](./examples/workflows/gemini- - workflow_name: _(Optional, default: `${{ github.workflow }}`)_ The GitHub workflow name, used for telemetry purposes. - + ### Outputs + - - summary: The summarized output from the Gemini CLI execution. - error: The error output from the Gemini CLI execution, if any. - + ### Repository Variables We recommend setting the following values as repository variables so they can be reused across all workflows. Alternatively, you can set them inline as action inputs in individual workflows or to override repository-level values. -| Name | Description | Type | Required | When Required | -| --------------------------- | ------------------------------------------------------ | -------- | -------- | ------------------------- | -| `DEBUG` | Enables debug logging for the Gemini CLI. | Variable | No | Never | -| `GEMINI_CLI_VERSION` | Controls which version of the Gemini CLI is installed. | Variable | No | Pinning the CLI version | -| `GCP_WIF_PROVIDER` | Full resource name of the Workload Identity Provider. | Variable | No | Using Google Cloud | -| `GOOGLE_CLOUD_PROJECT` | Google Cloud project for inference and observability. | Variable | No | Using Google Cloud | +| Name | Description | Type | Required | When Required | +| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | -------- | -------- | ------------------------------ | +| `DEBUG` | Enables debug logging for the Gemini CLI. | Variable | No | Never | +| `GEMINI_CLI_VERSION` | Controls which version of the Gemini CLI is installed. | Variable | No | Pinning the CLI version | +| `GCP_WIF_PROVIDER` | Full resource name of the Workload Identity Provider. | Variable | No | Using Google Cloud | +| `GOOGLE_CLOUD_PROJECT` | Google Cloud project for inference and observability. | Variable | No | Using Google Cloud | | `SERVICE_ACCOUNT_EMAIL` | Google Cloud service account email address. Optional - only needed for WIF with service account (not required for direct WIF). | Variable | No | Using WIF with service account | -| `GOOGLE_CLOUD_LOCATION` | Region of the Google Cloud project. | Variable | No | Using Google Cloud | -| `GOOGLE_GENAI_USE_VERTEXAI` | Set to `true` to use Vertex AI | Variable | No | Using Vertex AI | -| `GOOGLE_GENAI_USE_GCA` | Set to `true` to use Gemini Code Assist | Variable | No | Using Gemini Code Assist | -| `APP_ID` | GitHub App ID for custom authentication. | Variable | No | Using a custom GitHub App | +| `GOOGLE_CLOUD_LOCATION` | Region of the Google Cloud project. | Variable | No | Using Google Cloud | +| `GOOGLE_GENAI_USE_VERTEXAI` | Set to `true` to use Vertex AI | Variable | No | Using Vertex AI | +| `GOOGLE_GENAI_USE_GCA` | Set to `true` to use Gemini Code Assist | Variable | No | Using Gemini Code Assist | +| `APP_ID` | GitHub App ID for custom authentication. | Variable | No | Using a custom GitHub App | To add a repository variable: @@ -297,9 +297,9 @@ To ensure the security, reliability, and efficiency of your automated workflows, Key recommendations include: -* **Securing Your Repository:** Implementing branch and tag protection, and restricting pull request approvers. -* **Workflow Configuration:** Using Workload Identity Federation for secure authentication to Google Cloud, managing secrets effectively, and pinning action versions to prevent unexpected changes. -* **Monitoring and Auditing:** Regularly reviewing action logs and enabling OpenTelemetry for deeper insights into performance and behavior. +- **Securing Your Repository:** Implementing branch and tag protection, and restricting pull request approvers. +- **Workflow Configuration:** Using Workload Identity Federation for secure authentication to Google Cloud, managing secrets effectively, and pinning action versions to prevent unexpected changes. +- **Monitoring and Auditing:** Regularly reviewing action logs and enabling OpenTelemetry for deeper insights into performance and behavior. For a comprehensive guide on securing your repository and workflows, please refer to our [**Best Practices documentation**](./docs/best-practices.md). diff --git a/docs/authentication.md b/docs/authentication.md index 0ed6b5973..60f99389d 100644 --- a/docs/authentication.md +++ b/docs/authentication.md @@ -121,6 +121,7 @@ Basic setup for your repository: ``` **Required Parameters:** + - `OWNER/REPO`: Your GitHub repository in the format `owner/repo`. Here, `OWNER` means your GitHub organization (for organization-owned repos) or username (for user-owned repos). - `GOOGLE_CLOUD_PROJECT`: Your Google Cloud project ID. @@ -248,7 +249,7 @@ If the `APP_ID` and `APP_PRIVATE_KEY` secrets are not configured in your reposit **Limitations:** -* **Limited Permissions:** The `GITHUB_TOKEN` has a restricted set of permissions. You may need to grant additional permissions directly within your workflow file to enable specific functionalities, such as: +- **Limited Permissions:** The `GITHUB_TOKEN` has a restricted set of permissions. You may need to grant additional permissions directly within your workflow file to enable specific functionalities, such as: ```yaml permissions: @@ -257,7 +258,7 @@ permissions: pull-requests: 'write' ``` -* **Job-Scoped:** The token's access is limited to the repository where the workflow is running and expires when the job is complete. +- **Job-Scoped:** The token's access is limited to the repository where the workflow is running and expires when the job is complete. ### Method 2: Using a GitHub App (Recommended) @@ -267,14 +268,14 @@ For optimal security and control, we strongly recommend creating a custom GitHub 1. Navigate to **GitHub Settings** > **[Developer settings](https://github.com/settings/developers)** > **[GitHub Apps](https://github.com/settings/apps)** and click **New GitHub App**. 2. **Complete the app registration:** - * **GitHub App name:** Give your app a unique and descriptive name (e.g., `MyOrg-Gemini-Assistant`). - * **Homepage URL:** Enter your organization's website or the URL of the repository where you'll use the action. + - **GitHub App name:** Give your app a unique and descriptive name (e.g., `MyOrg-Gemini-Assistant`). + - **Homepage URL:** Enter your organization's website or the URL of the repository where you'll use the action. 3. **Disable Webhooks:** Uncheck the **Active** checkbox under the "Webhooks" section. This action does not require webhook notifications. 4. **Set Repository Permissions:** Under the "Repository permissions" section, grant the following permissions required for the example workflows: - * **Contents:** `Read & write` - * **Issues:** `Read & write` - * **Pull requests:** `Read & write` - > **Note:** Always adhere to the principle of least privilege. If your custom workflows require fewer permissions, adjust these settings accordingly. + - **Contents:** `Read & write` + - **Issues:** `Read & write` + - **Pull requests:** `Read & write` + > **Note:** Always adhere to the principle of least privilege. If your custom workflows require fewer permissions, adjust these settings accordingly. 5. Click **Create GitHub App**. An example manifest is also available at [`examples/github-app/custom_app_manifest.yml`](../examples/github-app/custom_app_manifest.yml). For details on registering a GitHub App from a manifest, see the [GitHub documentation](https://docs.github.com/en/apps/sharing-github-apps/registering-a-github-app-from-a-manifest). @@ -296,11 +297,11 @@ An example manifest is also available at [`examples/github-app/custom_app_manife 1. Navigate to your repository's **Settings** > **Secrets and variables** > **Actions**. 2. Select the **Variables** tab and click **New repository variable**. - * **Name:** `APP_ID` - * **Value:** Enter the App ID you noted earlier. + - **Name:** `APP_ID` + - **Value:** Enter the App ID you noted earlier. 3. Select the **Secrets** tab and click **New repository secret**. - * **Name:** `APP_PRIVATE_KEY` - * **Secret:** Paste the entire contents of the `.pem` file you downloaded. + - **Name:** `APP_PRIVATE_KEY` + - **Secret:** Paste the entire contents of the `.pem` file you downloaded. ## Additional Resources diff --git a/docs/best-practices.md b/docs/best-practices.md index 83b1938cf..2e30edef7 100644 --- a/docs/best-practices.md +++ b/docs/best-practices.md @@ -23,10 +23,10 @@ Protecting your branches and tags is critical to preventing unauthorized changes We recommend the following at a minimum for your `main` branch: -* **Require a pull request before merging** -* **Require a minimum number of approvals** -* **Dismiss stale approvals** -* **Require status checks to pass before merging** +- **Require a pull request before merging** +- **Require a minimum number of approvals** +- **Dismiss stale approvals** +- **Require status checks to pass before merging** For more information, see the GitHub documentation on [managing branch protections]. @@ -34,8 +34,8 @@ For more information, see the GitHub documentation on [managing branch protectio To prevent fraudulent or accidental approvals, you can restrict who can approve pull requests. -* **CODEOWNERS**: Use a [`CODEOWNERS` file] to define individuals or teams that are responsible for code in your repository. -* **Code review limits**: [Limit code review approvals] to specific users or teams. +- **CODEOWNERS**: Use a [`CODEOWNERS` file] to define individuals or teams that are responsible for code in your repository. +- **Code review limits**: [Limit code review approvals] to specific users or teams. ## Workflow Configuration diff --git a/docs/extensions.md b/docs/extensions.md index 3992c9abd..d37c1e23b 100644 --- a/docs/extensions.md +++ b/docs/extensions.md @@ -25,7 +25,7 @@ jobs: uses: google-github-actions/run-gemini-cli@v0 with: gemini_api_key: ${{ secrets.GEMINI_API_KEY }} - prompt: "/security:analyze" + prompt: '/security:analyze' extensions: | [ "https://github.com/gemini-cli-extensions/security", diff --git a/docs/observability.md b/docs/observability.md index cd7c92bef..01fe3ff17 100644 --- a/docs/observability.md +++ b/docs/observability.md @@ -66,6 +66,7 @@ After running the setup script, configure your GitHub Actions workflow with the ``` **Important**: To enable telemetry, you must include the `settings` configuration as shown above. This tells the Gemini CLI to: + - Enable telemetry collection - Send data to the local OpenTelemetry collector which forwards to your GCP project @@ -142,12 +143,14 @@ Alternatively, you can omit the `telemetry` settings entirely, as telemetry is d ## Troubleshooting **Telemetry not appearing in Google Cloud Console:** + 1. Verify that authentication is properly configured 2. Check that the required APIs are enabled in your GCP project 3. Ensure the service account has the necessary IAM permissions 4. Confirm telemetry is enabled in your workflow settings **Permission errors:** + - Verify your service account has these roles: - `roles/logging.logWriter` - `roles/monitoring.editor` diff --git a/examples/workflows/AWESOME.md b/examples/workflows/AWESOME.md index d659ca990..05e2bfefe 100644 --- a/examples/workflows/AWESOME.md +++ b/examples/workflows/AWESOME.md @@ -27,7 +27,7 @@ Browse workflows by category to find exactly what you're looking for. Workflows that help maintain code quality, perform analysis, or enforce standards. -*No workflows yet. Be the first to contribute!* +_No workflows yet. Be the first to contribute!_ ### ๐Ÿ“‹ Project Management @@ -70,19 +70,19 @@ Workflows that help manage GitHub issues, projects, or team collaboration. Workflows that generate, update, or maintain documentation automatically. -*No workflows yet. Be the first to contribute!* +_No workflows yet. Be the first to contribute!_ ### ๐Ÿ›ก๏ธ Security Workflows focused on security analysis, vulnerability detection, or compliance. -*No workflows yet. Be the first to contribute!* +_No workflows yet. Be the first to contribute!_ ### ๐Ÿงช Testing Workflows that enhance testing processes, generate test cases, or analyze test results. -*No workflows yet. Be the first to contribute!* +_No workflows yet. Be the first to contribute!_ ### ๐Ÿš€ Deployment & Release @@ -90,12 +90,13 @@ Workflows that handle deployment, release management, or publishing tasks. #### Generate Release Notes -**Repository:** [conforma/policy](https://github.com/conforma/policy) +**Repository:** [conforma/policy](https://github.com/conforma/policy) Make release notes based on all notable changes since a given tag. It categorizes the release notes nicely with emojis, output as Markdown. **Key Features:** + - Categorize changes in release notes - Include relevant links in release notes - Add fun emojis in release notes @@ -106,12 +107,12 @@ It categorizes the release notes nicely with emojis, output as Markdown. Unique or domain-specific workflows that showcase creative uses of Gemini CLI. -*No workflows yet. Be the first to contribute!* +_No workflows yet. Be the first to contribute!_ ## Featured Workflows -*Coming soon!* This section will highlight particularly innovative or popular community workflows. +_Coming soon!_ This section will highlight particularly innovative or popular community workflows. --- -*Want to see your workflow featured here? Check out our [submission guidelines](./README.md#share-your-workflow)!* +_Want to see your workflow featured here? Check out our [submission guidelines](./README.md#share-your-workflow)!_ diff --git a/examples/workflows/README.md b/examples/workflows/README.md index 8a41ebdb6..f02643ed1 100644 --- a/examples/workflows/README.md +++ b/examples/workflows/README.md @@ -11,16 +11,17 @@ This directory contains a collection of example workflows that demonstrate how t ## Available Workflows -* **[Gemini Dispatch](./gemini-dispatch)**: A central dispatcher that routes requests to the appropriate workflow based on the triggering event and the command provided in the comment. -* **[Issue Triage](./issue-triage)**: Automatically triage GitHub issues using Gemini. This workflow can be configured to run on a schedule or be triggered by issue events. -* **[Pull Request Review](./pr-review)**: Automatically review pull requests using Gemini. This workflow can be triggered by pull request events and provides a comprehensive review of the changes. -* **[Gemini CLI Assistant](./gemini-assistant)**: A general-purpose, conversational AI assistant that can be invoked within pull requests and issues to perform a wide range of tasks. +- **[Gemini Dispatch](./gemini-dispatch)**: A central dispatcher that routes requests to the appropriate workflow based on the triggering event and the command provided in the comment. +- **[Issue Triage](./issue-triage)**: Automatically triage GitHub issues using Gemini. This workflow can be configured to run on a schedule or be triggered by issue events. +- **[Pull Request Review](./pr-review)**: Automatically review pull requests using Gemini. This workflow can be triggered by pull request events and provides a comprehensive review of the changes. +- **[Gemini CLI Assistant](./gemini-assistant)**: A general-purpose, conversational AI assistant that can be invoked within pull requests and issues to perform a wide range of tasks. ## Setup For detailed setup instructions, including prerequisites and authentication, please refer to the main [Authentication documentation](../../docs/authentication.md). To use a workflow, you can utilize either of the following steps: + - Run the `/setup-github` command in Gemini CLI on your terminal to set up workflows for your repository. - Copy the workflow files into your repository's `.github/workflows` directory. @@ -38,9 +39,10 @@ Discover awesome workflows created by the community! These are publicly availabl ### Share Your Workflow -Have you created an awesome workflow using Gemini CLI? We'd love to feature it in our [Awesome Workflows](./AWESOME.md) page! +Have you created an awesome workflow using Gemini CLI? We'd love to feature it in our [Awesome Workflows](./AWESOME.md) page! **Submission Process:** + 1. **Ensure your workflow is public** and well-documented 2. **Fork this repository** and create a new branch 3. **Add your workflow** to the appropriate category section in [AWESOME.md](./AWESOME.md) using the [workflow template](./AWESOME.md#workflow-template) @@ -49,6 +51,7 @@ Have you created an awesome workflow using Gemini CLI? We'd love to feature it i 5. **Include a brief summary** in your PR description of what your workflow does and why it's awesome **What makes a workflow "awesome"?** + - Solves a real problem or provides significant value - Is well-documented with clear setup instructions - Follows best practices for security and performance @@ -64,20 +67,23 @@ When adding your workflow to [AWESOME.md](./AWESOME.md), use this format: ```markdown #### -**Repository:** [/](https://github.com//) +**Repository:** [/](https://github.com//) Brief description of what the workflow does and its key features. **Key Features:** + - Feature 1 - Feature 2 - Feature 3 **Setup Requirements:** + - Requirement 1 - Requirement 2 (if any) **Example Use Cases:** + - Use case 1 - Use case 2 diff --git a/examples/workflows/gemini-assistant/README.md b/examples/workflows/gemini-assistant/README.md index 2c791fc1c..dc597375f 100644 --- a/examples/workflows/gemini-assistant/README.md +++ b/examples/workflows/gemini-assistant/README.md @@ -50,6 +50,7 @@ gha-creds-*.json ### Setup Methods To use this workflow, you can utilize either of the following methods: + 1. Run the `/setup-github` command in Gemini CLI on your terminal to set up workflows for your repository. 2. Copy the workflow files into your repository's `.github/workflows` directory: @@ -77,7 +78,7 @@ The Gemini CLI Assistant workflow is triggered by new comments in: - GitHub Pull Request review comments - GitHub Issues -The Gemini CLI Assistant workflow is intentionally configured *not* to respond to comments containing `/review` or `/triage` to avoid conflicts with other dedicated workflows (such as [the Gemini CLI Pull Request workflow](../pr-review) or [the issue triage workflow](../issue-triage)). +The Gemini CLI Assistant workflow is intentionally configured _not_ to respond to comments containing `/review` or `/triage` to avoid conflicts with other dedicated workflows (such as [the Gemini CLI Pull Request workflow](../pr-review) or [the issue triage workflow](../issue-triage)). ### How to Invoke the Gemini CLI Workflow @@ -142,6 +143,7 @@ The Gemini CLI assistant prompt is defined in the `gemini-invoke.toml` file. The **To customize the assistant prompt:** 1. Copy the TOML file to your repository: + ```bash mkdir -p .gemini/commands curl -o .gemini/commands/gemini-invoke.toml https://raw.githubusercontent.com/google-github-actions/run-gemini-cli/main/examples/workflows/gemini-assistant/gemini-invoke.toml diff --git a/examples/workflows/gemini-dispatch/README.md b/examples/workflows/gemini-dispatch/README.md index b1f0aeae8..f81797df7 100644 --- a/examples/workflows/gemini-dispatch/README.md +++ b/examples/workflows/gemini-dispatch/README.md @@ -13,27 +13,27 @@ This workflow acts as a central dispatcher for Gemini CLI, routing requests to t This workflow is triggered by the following events: -* Pull request review comment (created) -* Pull request review (submitted) -* Pull request (opened) -* Issue (opened, reopened) -* Issue comment (created) +- Pull request review comment (created) +- Pull request review (submitted) +- Pull request (opened) +- Issue (opened, reopened) +- Issue comment (created) ## Dispatch Logic The workflow uses a dispatch job to determine which command to execute based on the following logic: -* If a comment contains `@gemini-cli /review`, it calls the `gemini-review.yml` workflow. -* If a comment contains `@gemini-cli /triage`, it calls the `gemini-triage.yml` workflow. -* If a comment contains `@gemini-cli` (without a specific command), it calls the `gemini-invoke.yml` workflow. -* When a new pull request is opened, it calls the `gemini-review.yml` workflow. -* When a new issue is opened or reopened, it calls the `gemini-triage.yml` workflow. +- If a comment contains `@gemini-cli /review`, it calls the `gemini-review.yml` workflow. +- If a comment contains `@gemini-cli /triage`, it calls the `gemini-triage.yml` workflow. +- If a comment contains `@gemini-cli` (without a specific command), it calls the `gemini-invoke.yml` workflow. +- When a new pull request is opened, it calls the `gemini-review.yml` workflow. +- When a new issue is opened or reopened, it calls the `gemini-triage.yml` workflow. ## In-Built Workflows -* **[gemini-review.yml](../pr-review/gemini-review.yml):** This workflow reviews a pull request. -* **[gemini-triage.yml](../issue-triage/gemini-triage.yml):** This workflow triages an issue. -* **[gemini-invoke.yml](../gemini-assistant/gemini-invoke.yml):** This workflow is a general-purpose workflow that can be used to perform various tasks. +- **[gemini-review.yml](../pr-review/gemini-review.yml):** This workflow reviews a pull request. +- **[gemini-triage.yml](../issue-triage/gemini-triage.yml):** This workflow triages an issue. +- **[gemini-invoke.yml](../gemini-assistant/gemini-invoke.yml):** This workflow is a general-purpose workflow that can be used to perform various tasks. ## Adding Your Own Workflows @@ -41,7 +41,7 @@ You can easily extend the dispatch workflow to include your own custom workflows 1. **Create your workflow file:** Create a new YAML file in the `.github/workflows` directory with your custom workflow logic. Make sure your workflow is designed to be called by `workflow_call`. 2. **Define a new command:** Decide on a new command to trigger your workflow, for example, `@gemini-cli /my-command`. -3. **Update the `dispatch` job:** In `gemini-dispatch.yml`, add a new condition to the `if` statement in the `dispatch` job to recognize your new command. +3. **Update the `dispatch` job:** In `gemini-dispatch.yml`, add a new condition to the `if` statement in the `dispatch` job to recognize your new command. 4. **Add a new job to call your workflow:** Add a new job to `gemini-dispatch.yml` that calls your custom workflow file. ## Usage diff --git a/examples/workflows/gemini-dispatch/gemini-dispatch.yml b/examples/workflows/gemini-dispatch/gemini-dispatch.yml index 22d0b27a3..728715fee 100644 --- a/examples/workflows/gemini-dispatch/gemini-dispatch.yml +++ b/examples/workflows/gemini-dispatch/gemini-dispatch.yml @@ -25,7 +25,7 @@ defaults: jobs: debugger: if: |- - ${{ fromJSON(vars.DEBUG || vars.ACTIONS_STEP_DEBUG || false) }} + ${{ fromJSON(vars.DEBUG || vars.ACTIONS_STEP_DEBUG || false) }} runs-on: 'ubuntu-latest' permissions: contents: 'read' diff --git a/examples/workflows/issue-triage/README.md b/examples/workflows/issue-triage/README.md index efd54c505..379b27aad 100644 --- a/examples/workflows/issue-triage/README.md +++ b/examples/workflows/issue-triage/README.md @@ -33,7 +33,6 @@ The Issue Triage workflows provide an automated system for analyzing and categor - **Error Handling**: Posts helpful comments when triage fails with links to logs - **Manual Override**: Support for manual triage requests via comments - ## Setup For detailed setup instructions, including prerequisites and authentication, please refer to the main [Getting Started](../../../README.md#quick-start) section and [Authentication documentation](../../../docs/authentication.md). @@ -53,6 +52,7 @@ gha-creds-*.json ### Setup Methods To implement this issue triage system, you can utilize either of the following methods: + 1. Run the `/setup-github` command in Gemini CLI on your terminal to set up workflows for your repository. 2. Copy the workflow files into your repository's `.github/workflows` directory: @@ -140,6 +140,7 @@ The triage prompts are defined in TOML files (`gemini-triage.toml` for real-time **To customize the triage prompts:** 1. Copy the TOML files to your repository: + ```bash mkdir -p .gemini/commands curl -o .gemini/commands/gemini-triage.toml https://raw.githubusercontent.com/google-github-actions/run-gemini-cli/main/examples/workflows/issue-triage/gemini-triage.toml @@ -161,6 +162,7 @@ The triage prompts are defined in TOML files (`gemini-triage.toml` for real-time **Additional workflow customization:** You can also modify the workflow files themselves to adjust: + - **Schedule Frequency**: Modify the cron schedule for batch triage - **Timeout Settings**: Adjust `timeout-minutes` for complex repositories - **Custom Filters**: Set criteria for which issues need triage @@ -172,15 +174,17 @@ For more details on workflow configuration, see the [Configuration Guide](../CON ## Examples ### Basic Triage Request + ``` @gemini-cli /triage ``` ### Automatic Labeling + The AI will analyze issues and apply labels such as: + - `bug` - for reported bugs and errors - `enhancement` - for feature requests - `documentation` - for docs-related issues - `priority/high` - for urgent issues - `good first issue` - for beginner-friendly tasks - diff --git a/examples/workflows/pr-review/README.md b/examples/workflows/pr-review/README.md index 93b89889c..2b91c5564 100644 --- a/examples/workflows/pr-review/README.md +++ b/examples/workflows/pr-review/README.md @@ -29,8 +29,8 @@ This document explains how to use the Gemini CLI on GitHub to automatically revi - [Performance Review](#performance-review) - [Breaking Changes Check](#breaking-changes-check) - [Extending to Support Forks](#extending-to-support-forks) - - [1. Simple Fork Support](#1-simple-fork-support) - - [2. Using `pull_request_target` Event](#2-using-pull_request_target-event) + - [1. Simple Fork Support](#1-simple-fork-support) + - [2. Using `pull_request_target` Event](#2-using-pull_request_target-event) ## Overview @@ -65,6 +65,7 @@ gha-creds-*.json ### Setup Methods To use this workflow, you can use either of the following methods: + 1. Run the `/setup-github` command in Gemini CLI on your terminal to set up workflows for your repository. 2. Copy the workflow files into your repository's `.github/workflows` directory: @@ -130,6 +131,7 @@ flowchart TD ### Automatic Reviews The workflow automatically triggers on: + - **New PRs**: When a pull request is opened ### Manual Reviews @@ -146,7 +148,7 @@ You can provide specific focus areas by adding instructions after the trigger: ``` @gemini-cli /review focus on security -@gemini-cli /review check performance and memory usage +@gemini-cli /review check performance and memory usage @gemini-cli /review please review error handling @gemini-cli /review look for breaking changes ``` @@ -154,6 +156,7 @@ You can provide specific focus areas by adding instructions after the trigger: ### Manual Workflow Dispatch You can also trigger reviews through the GitHub Actions UI: + 1. Go to Actions tab in your repository 2. Select "Gemini PR Review" workflow 3. Click "Run workflow" @@ -167,25 +170,25 @@ The AI review follows a structured format, providing both a high-level summary a After posting all inline comments, the action submits the review with a final summary comment that includes: -- **Review Summary**: A brief 2-3 sentence overview of the pull request and the overall assessment. -- **General Feedback**: High-level observations about code quality, architectural patterns, positive implementation aspects, or recurring themes that were not addressed in inline comments. - +- **Review Summary**: A brief 2-3 sentence overview of the pull request and the overall assessment. +- **General Feedback**: High-level observations about code quality, architectural patterns, positive implementation aspects, or recurring themes that were not addressed in inline comments. ### Specific Feedback (Inline Comments) The action provides specific, actionable feedback directly on the relevant lines of code in the pull request. Each comment includes: -- **Priority**: An emoji indicating the severity of the feedback. - - ๐Ÿ”ด **Critical**: Must be fixed before merging (e.g., security vulnerabilities, breaking changes). - - ๐ŸŸ  **High**: Should be addressed (e.g., performance issues, design flaws). - - ๐ŸŸก **Medium**: Recommended improvements (e.g., code quality, style). - - ๐ŸŸข **Low**: Nice-to-have suggestions (e.g., documentation, minor refactoring). - - ๐Ÿ”ต **Unclear**: Priority is not determined. -- **Suggestion**: A code block with a suggested change, where applicable. +- **Priority**: An emoji indicating the severity of the feedback. + - ๐Ÿ”ด **Critical**: Must be fixed before merging (e.g., security vulnerabilities, breaking changes). + - ๐ŸŸ  **High**: Should be addressed (e.g., performance issues, design flaws). + - ๐ŸŸก **Medium**: Recommended improvements (e.g., code quality, style). + - ๐ŸŸข **Low**: Nice-to-have suggestions (e.g., documentation, minor refactoring). + - ๐Ÿ”ต **Unclear**: Priority is not determined. +- **Suggestion**: A code block with a suggested change, where applicable. **Example Inline Comment:** > ๐ŸŸข Use camelCase for function names +> > ```suggestion > myFunction > ``` @@ -218,6 +221,7 @@ The review prompt is defined in the `gemini-review.toml` file. The action automa **To customize the review prompt:** 1. Copy the TOML file to your repository: + ```bash mkdir -p .gemini/commands curl -o .gemini/commands/gemini-review.toml https://raw.githubusercontent.com/google-github-actions/run-gemini-cli/main/examples/workflows/pr-review/gemini-review.toml @@ -242,21 +246,25 @@ For more details on workflow configuration, see the [Configuration Guide](../CON ## Examples ### Basic Review Request + ``` @gemini-cli /review ``` ### Security-Focused Review + ``` @gemini-cli /review focus on security vulnerabilities and authentication ``` ### Performance Review + ``` @gemini-cli /review check for performance issues and optimization opportunities ``` ### Breaking Changes Check + ``` @gemini-cli /review look for potential breaking changes and API compatibility ``` @@ -271,7 +279,7 @@ from forks could enable bad actors to access secrets. This behavior may not be ideal for all use cases - such as private repositories. To enable the `pr-review` workflow to run on branches in forks, there are several -approaches depending on your authentication setup and security requirements. +approaches depending on your authentication setup and security requirements. Please refer to the GitHub documentation links provided below for the security and access considerations of doing so. @@ -288,7 +296,9 @@ can enable fork support by simply removing the fork restriction condition in the dispatch workflow. **Implementation**: + 1. Remove the fork restriction in `gemini-dispatch.yml`: + ```yaml # Change this condition to remove the fork check if: |- @@ -304,7 +314,6 @@ dispatch workflow. in their fork as described in the [Authentication documentation](../../../docs/authentication.md). - #### 2. Using `pull_request_target` Event This could work for private repositories where you want to provide API access diff --git a/package-lock.json b/package-lock.json index 078e8d579..2b0aa36e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,10 @@ "version": "0.1.16", "license": "Apache-2.0", "devDependencies": { - "@google-github-actions/actions-utils": "^0.8.10" + "@google-github-actions/actions-utils": "^0.8.10", + "husky": "^9.1.7", + "lint-staged": "^16.2.7", + "prettier": "^3.7.4" }, "engines": { "node": ">= 20.x", @@ -33,6 +36,513 @@ "npm": ">= 10.x" } }, + "node_modules/ansi-escapes": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-7.2.0.tgz", + "integrity": "sha512-g6LhBsl+GBPRWGWsBtutpzBYuIIdBkLEvad5C/va/74Db018+5TZiyA26cZJAr3Rft5lprVqOIPxf5Vid6tqAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "environment": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cli-cursor": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-5.0.0.tgz", + "integrity": "sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==", + "dev": true, + "license": "MIT", + "dependencies": { + "restore-cursor": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-5.1.1.tgz", + "integrity": "sha512-SroPvNHxUnk+vIW/dOSfNqdy1sPEFkrTk6TUtqLCnBlo3N7TNYYkzzN7uSD6+jVjrdO4+p8nH7JzH6cIvUem6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "slice-ansi": "^7.1.0", + "string-width": "^8.0.0" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true, + "license": "MIT" + }, + "node_modules/commander": { + "version": "14.0.2", + "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.2.tgz", + "integrity": "sha512-TywoWNNRbhoD0BXs1P3ZEScW8W5iKrnbithIl0YH+uCmBd0QpPOA8yc82DS3BIE5Ma6FnBVUsJ7wVUDz4dvOWQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" + } + }, + "node_modules/emoji-regex": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz", + "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==", + "dev": true, + "license": "MIT" + }, + "node_modules/environment": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/environment/-/environment-1.1.0.tgz", + "integrity": "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "dev": true, + "license": "MIT" + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/get-east-asian-width": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.4.0.tgz", + "integrity": "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/husky": { + "version": "9.1.7", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz", + "integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==", + "dev": true, + "license": "MIT", + "bin": { + "husky": "bin.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-5.1.0.tgz", + "integrity": "sha512-5XHYaSyiqADb4RnZ1Bdad6cPp8Toise4TzEjcOYDHZkTCbKgiUl7WTUCpNWHuxmDt91wnsZBc9xinNzopv3JMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-east-asian-width": "^1.3.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/lint-staged": { + "version": "16.2.7", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-16.2.7.tgz", + "integrity": "sha512-lDIj4RnYmK7/kXMya+qJsmkRFkGolciXjrsZ6PC25GdTfWOAWetR0ZbsNXRAj1EHHImRSalc+whZFg56F5DVow==", + "dev": true, + "license": "MIT", + "dependencies": { + "commander": "^14.0.2", + "listr2": "^9.0.5", + "micromatch": "^4.0.8", + "nano-spawn": "^2.0.0", + "pidtree": "^0.6.0", + "string-argv": "^0.3.2", + "yaml": "^2.8.1" + }, + "bin": { + "lint-staged": "bin/lint-staged.js" + }, + "engines": { + "node": ">=20.17" + }, + "funding": { + "url": "https://opencollective.com/lint-staged" + } + }, + "node_modules/listr2": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-9.0.5.tgz", + "integrity": "sha512-ME4Fb83LgEgwNw96RKNvKV4VTLuXfoKudAmm2lP8Kk87KaMK0/Xrx/aAkMWmT8mDb+3MlFDspfbCs7adjRxA2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "cli-truncate": "^5.0.0", + "colorette": "^2.0.20", + "eventemitter3": "^5.0.1", + "log-update": "^6.1.0", + "rfdc": "^1.4.1", + "wrap-ansi": "^9.0.0" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/log-update": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-6.1.0.tgz", + "integrity": "sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-escapes": "^7.0.0", + "cli-cursor": "^5.0.0", + "slice-ansi": "^7.1.0", + "strip-ansi": "^7.1.0", + "wrap-ansi": "^9.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/micromatch/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/mimic-function": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/mimic-function/-/mimic-function-5.0.1.tgz", + "integrity": "sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/nano-spawn": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/nano-spawn/-/nano-spawn-2.0.0.tgz", + "integrity": "sha512-tacvGzUY5o2D8CBh2rrwxyNojUsZNU2zjNTzKQrkgGJQTbGAfArVWXSKMBokBeeg6C7OLRGUEyoFlYbfeWQIqw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.17" + }, + "funding": { + "url": "https://github.com/sindresorhus/nano-spawn?sponsor=1" + } + }, + "node_modules/onetime": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-7.0.0.tgz", + "integrity": "sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-function": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pidtree": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "dev": true, + "license": "MIT", + "bin": { + "pidtree": "bin/pidtree.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/prettier": { + "version": "3.7.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.7.4.tgz", + "integrity": "sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/restore-cursor": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-5.1.0.tgz", + "integrity": "sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==", + "dev": true, + "license": "MIT", + "dependencies": { + "onetime": "^7.0.0", + "signal-exit": "^4.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/rfdc": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz", + "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==", + "dev": true, + "license": "MIT" + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/slice-ansi": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-7.1.2.tgz", + "integrity": "sha512-iOBWFgUX7caIZiuutICxVgX1SdxwAVFFKwt1EvMYYec/NWO5meOJ6K5uQxhrYBdQJne4KxiqZc+KptFOWFSI9w==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.2.1", + "is-fullwidth-code-point": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/string-argv": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.6.19" + } + }, + "node_modules/string-width": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-8.1.0.tgz", + "integrity": "sha512-Kxl3KJGb/gxkaUMOjRsQ8IrXiGW75O4E3RPjFIINOVH8AMl2SQ/yWdTzWwF3FevIX9LcMAjJW+GRwAlAbTSXdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-east-asian-width": "^1.3.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strip-ansi": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", + "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/wrap-ansi": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz", + "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.2.1", + "string-width": "^7.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/yaml": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.1.tgz", diff --git a/package.json b/package.json index 695d10fe1..312778c10 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,13 @@ "scripts": { "build": "echo \"No build required for composite action\"", "docs": "./node_modules/.bin/actions-gen-readme", - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "format": "prettier --write .", + "format:check": "prettier --check .", + "prepare": "husky" + }, + "lint-staged": { + "**/*": "prettier --write --ignore-unknown" }, "engines": { "node": ">= 20.x", @@ -26,6 +32,9 @@ }, "homepage": "https://github.com/google-github-actions/run-gemini-cli#readme", "devDependencies": { - "@google-github-actions/actions-utils": "^0.8.10" + "@google-github-actions/actions-utils": "^0.8.10", + "husky": "^9.1.7", + "lint-staged": "^16.2.7", + "prettier": "^3.7.4" } }