Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/gemini-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/gemini-issue-fixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 9 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -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
}
17 changes: 17 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 80,
"tabWidth": 2
}
105 changes: 55 additions & 50 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
```
Expand Down
26 changes: 13 additions & 13 deletions GEMINI.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ go to the [Gemini Assistant workflow documentation](./examples/workflows/gemini-

### Inputs

<!-- prettier-ignore-start -->
<!-- BEGIN_AUTOGEN_INPUTS -->

- <a name="__input_gcp_location"></a><a href="#user-content-__input_gcp_location"><code>gcp_location</code></a>: _(Optional)_ The Google Cloud location.

- <a name="__input_gcp_project_id"></a><a href="#user-content-__input_gcp_project_id"><code>gcp_project_id</code></a>: _(Optional)_ The Google Cloud project ID.
Expand Down Expand Up @@ -193,35 +193,35 @@ go to the [Gemini Assistant workflow documentation](./examples/workflows/gemini-

- <a name="__input_workflow_name"></a><a href="#user-content-__input_workflow_name"><code>workflow_name</code></a>: _(Optional, default: `${{ github.workflow }}`)_ The GitHub workflow name, used for telemetry purposes.


<!-- END_AUTOGEN_INPUTS -->
<!-- prettier-ignore-end -->

### Outputs

<!-- prettier-ignore-start -->
<!-- BEGIN_AUTOGEN_OUTPUTS -->

- <a name="__output_summary"></a><a href="#user-content-__output_summary"><code>summary</code></a>: The summarized output from the Gemini CLI execution.

- <a name="__output_error"></a><a href="#user-content-__output_error"><code>error</code></a>: The error output from the Gemini CLI execution, if any.


<!-- END_AUTOGEN_OUTPUTS -->
<!-- prettier-ignore-end -->

### 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:

Expand Down Expand Up @@ -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).

Expand Down
Loading
Loading