Set review votes and comments on a Gerrit system via SSH. This action allows automated CI/CD workflows to provide feedback on Gerrit changes by posting votes, comments, and status updates.
steps:
- name: "Set Gerrit review vote"
uses: lfreleng-actions/gerrit-review-action@main
with:
host: "gerrit.example.com"
username: "ci-bot"
key: ${{ secrets.GERRIT_SSH_KEY }}
known_hosts: ${{ secrets.GERRIT_KNOWN_HOSTS }}
gerrit-change-number: "12345"
gerrit-patchset-number: "1"
vote-type: "success"| Name | Required | Default | Description |
|---|---|---|---|
| host | True | The Gerrit host with SSH available | |
| port | False | "29418" | The SSH port to use |
| username | True | The username to connect to the Gerrit host as | |
| key | True | The SSH private key to use | |
| key_name | False | "id_rsa" | The filename for the key |
| known_hosts | True | The known hosts for the host server | |
| gerrit-change-number | True | The Gerrit Change Number to vote on | |
| gerrit-patchset-number | False | "1" | The patchset number of the change |
| vote-type | False | "clear" | Vote type: clear, success, failure, cancelled |
| comment-only | False | "false" | Post comment without voting |
This action does not produce any outputs.
The action supports four different vote types:
- Vote: Verified=0, Code-Review=0
- Usage: Reset/clear existing votes on a change
- Status Message: "STARTED"
- Vote: Verified=+1
- Usage: Mark the change as verified/passing
- Status Message: "SUCCESS"
- Vote: Verified=-1
- Usage: Mark the change as failing verification
- Status Message: "FAILURE"
- Vote: Verified=-1, Code-Review=-1
- Usage: Mark the workflow run as cancelled/aborted (inconclusive result)
- Status Message: "CANCELLED"
When comment-only is "true", the action posts a status comment
without applying votes. This provides informational updates
without affecting the review workflow.
The action requires SSH access to the Gerrit server. You must provide:
- SSH Private Key: Store in GitHub secrets (e.g.,
GERRIT_SSH_KEY) - Known Hosts: The SSH fingerprint for the Gerrit server
- Username: The Gerrit username for the CI account
- Host: The Gerrit server hostname
The action automatically configures SSH with the provided credentials and accepts legacy SSH-RSA key types for compatibility with Gerrit servers.
The action performs the following steps:
- SSH Setup: Installs the provided SSH key and configures connection
- Vote Preparation: Determines the appropriate vote and status based on
the
vote-typeinput - Gerrit Review: Executes the
gerrit reviewcommand with:- Change and patchset numbers
- Appropriate vote labels (if not comment mode)
- Status message with GitHub Actions run URL
autogenerated:githubtag for tracking
All reviews include a status message linking back to the GitHub Actions run:
{STATUS}: https://github.com/{owner}/{repo}/actions/runs/{run_id}
This provides traceability between Gerrit reviews and the CI/CD pipeline that generated them.
- The action skips SSH operations when running in ACT (local testing)
- All reviews include the
autogenerated:githubtag for identification - The action supports both legacy and modern SSH key types
- Default SSH port 29418 is commonly used by Gerrit servers