https://github.com/leinardi/gha-pre-commit-reviewdog-template
Template for GitHub Actions that run pre-commit hooks
https://github.com/leinardi/gha-pre-commit-reviewdog-template
gh-leinardi-iac github-actions pre-commit reviewdog
Last synced: about 2 months ago
JSON representation
Template for GitHub Actions that run pre-commit hooks
- Host: GitHub
- URL: https://github.com/leinardi/gha-pre-commit-reviewdog-template
- Owner: leinardi
- License: mit
- Created: 2025-12-03T15:57:13.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2026-04-22T11:53:14.000Z (about 2 months ago)
- Last Synced: 2026-04-22T13:32:10.848Z (about 2 months ago)
- Topics: gh-leinardi-iac, github-actions, pre-commit, reviewdog
- Language: Shell
- Homepage:
- Size: 62.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Run via pre-commit + reviewdog
> Template README — replace `` and `` with your actual tool and pre-commit hook name.
This GitHub Action runs a single [`pre-commit`](https://pre-commit.com/) hook on a diff range and reports results to pull requests
using [reviewdog](https://github.com/reviewdog/reviewdog).
Typical use case:
- Run the `` pre-commit hook (e.g. `actionlint-oneline`)
- Annotate problems directly on the PR diff
- Fail the job if violations are found
## Requirements
- A `.pre-commit-config.yaml` in your repository with the `` hook enabled
- GitHub Actions enabled on the repository
- `secrets.GITHUB_TOKEN` available (default on GitHub-hosted runners)
## Inputs
| Name | Required | Description |
|----------------|----------|-----------------------------------------------------|
| `from-ref` | ✅ | Base git ref (e.g. PR base SHA) |
| `to-ref` | ✅ | Head git ref (e.g. PR head SHA) |
| `github-token` | ✅ | GitHub token for reviewdog (`secrets.GITHUB_TOKEN`) |
## Outputs
| Name | Description |
|------------|----------------------------------------------|
| `exitcode` | Exit code of the `` pre-commit hook |
## Usage
In your workflow (example for a pull request):
```yaml
name: Lint with
on:
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Run via pre-commit + reviewdog
uses: /@v1
with:
from-ref: ${{ github.event.pull_request.base.sha }}
to-ref: ${{ github.event.pull_request.head.sha }}
github-token: ${{ secrets.GITHUB_TOKEN }}
````
## Versioning
It’s recommended to pin to the major version:
```yaml
uses: /@v1
```
For fully reproducible behavior, pin to an exact tag:
```yaml
uses: /@v1.0.0
```