https://github.com/j178/prek-action
A GitHub Action that runs pre-commit hooks using prek in your CI/CD pipeline
https://github.com/j178/prek-action
Last synced: 4 months ago
JSON representation
A GitHub Action that runs pre-commit hooks using prek in your CI/CD pipeline
- Host: GitHub
- URL: https://github.com/j178/prek-action
- Owner: j178
- License: mit
- Created: 2025-09-08T01:23:06.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2026-03-30T12:25:52.000Z (4 months ago)
- Last Synced: 2026-03-30T14:32:10.880Z (4 months ago)
- Language: TypeScript
- Homepage: https://github.com/marketplace/actions/prek-action
- Size: 767 KB
- Stars: 71
- Watchers: 4
- Forks: 7
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# Prek Action
Run [prek](https://github.com/j178/prek) in your GitHub Actions workflows.
## Usage
```yaml
name: Prek checks
on: [push, pull_request]
jobs:
prek:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: j178/prek-action@v2
```
`prek` is always invoked as:
```text
prek run --show-diff-on-failure --color=always
```
## Version Tags
Major and minor tags are moving tags. For example, `v2` and `v2.0` are not fixed releases:
- `v2` always points to the latest `v2.x.y` release
- `v2.0` always points to the latest `v2.0.y` release
For a stable reference, pin to a specific release tag such as `v2.0.0`, or pin to a commit SHA.
## Inputs
| Input | Description | Required | Default |
| --- | --- | --- | --- |
| `extra-args` | Additional arguments appended to `prek run --show-diff-on-failure --color=always` | No | `--all-files` |
| `extra_args` | Deprecated alias for `extra-args` | No | |
| `prek-version` | Version or semver range to install, for example `0.2.30`, `0.3.x`, `<=1.0.0`, or `latest` | No | `latest` |
| `install-only` | Install `prek` but skip `prek run` | No | `false` |
| `working-directory` | Directory where `prek run` is executed | No | `.` |
| `show-verbose-logs` | Print the `prek` verbose log after `prek run` completes | No | `true` |
| `cache` | Cache the prek environment between workflow runs | No | `true` |
| `token` | Deprecated and unused; retained for backward compatibility | No | `''` |
## Outputs
| Output | Description |
| --- | --- |
| `prek-version` | The resolved `prek` version, normalized to a `v`-prefixed tag |
| `cache-hit` | Whether the restored prek cache exactly matched the computed primary cache key |
## Examples
Install and run against all files:
```yaml
steps:
- uses: actions/checkout@v6
- uses: j178/prek-action@v2
```
Pass extra arguments:
```yaml
steps:
- uses: actions/checkout@v6
- uses: j178/prek-action@v2
with:
extra-args: '--all-files --directory packages/'
```
Pin a specific `prek` version:
```yaml
steps:
- uses: actions/checkout@v6
- uses: j178/prek-action@v2
with:
prek-version: '0.2.30'
```
Resolve a semver range:
```yaml
steps:
- uses: actions/checkout@v6
- uses: j178/prek-action@v2
with:
prek-version: '0.3.x'
```
Install only:
```yaml
steps:
- uses: actions/checkout@v6
- uses: j178/prek-action@v2
with:
install-only: true
- run: prek run --show-diff-on-failure --color=always --all-files
```
Disable verbose log output after the run:
```yaml
steps:
- uses: actions/checkout@v6
- uses: j178/prek-action@v2
with:
show-verbose-logs: false
```
## Requirements
The target repository needs a `prek` or pre-commit configuration file:
- `prek.toml`
- `.pre-commit-config.yaml`
- `.pre-commit-config.yml`
## Contributing
For contributor setup, testing, bundling, and release steps, see [CONTRIBUTING.md](CONTRIBUTING.md).