Run prek in your GitHub Actions workflows.
name: Prek checks
on: [push, pull_request]
jobs:
prek:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: j178/prek-action@v1prek is always invoked as:
prek run --show-diff-on-failure --color=always <extra-args>
Major and minor tags are moving tags. For example, v1 and v1.1 are not fixed releases:
v1always points to the latestv1.x.yreleasev1.1always points to the latestv1.1.yrelease
For a stable reference, pin to a specific release tag such as v1.2.3, or pin to a commit SHA.
| 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 | |
install-only |
Install prek but skip prek run |
No | false |
prek-version |
Version or semver range to install, for example 0.2.30, 0.3.x, <=1.0.0, or latest |
No | latest |
working-directory |
Directory where prek run is executed |
No | . |
show-verbose-logs |
Print the prek verbose log after prek run completes |
No | true |
token |
Unused; retained for backward compatibility | No | ${{ github.token }} |
| Output | Description |
|---|---|
prek-version |
The resolved prek version, normalized to a v-prefixed tag |
Install and run against all files:
steps:
- uses: actions/checkout@v6
- uses: j178/prek-action@v1Pass extra arguments:
steps:
- uses: actions/checkout@v6
- uses: j178/prek-action@v1
with:
extra-args: '--all-files --directory packages/'Pin a specific prek version:
steps:
- uses: actions/checkout@v6
- uses: j178/prek-action@v1
with:
prek-version: '0.2.30'Resolve a semver range:
steps:
- uses: actions/checkout@v6
- uses: j178/prek-action@v1
with:
prek-version: '0.3.x'Install only:
steps:
- uses: actions/checkout@v6
- uses: j178/prek-action@v1
with:
install-only: true
- run: prek run --show-diff-on-failure --color=always --all-filesDisable verbose log output after the run:
steps:
- uses: actions/checkout@v6
- uses: j178/prek-action@v1
with:
show-verbose-logs: falseThe target repository needs a prek or pre-commit configuration file:
prek.toml.pre-commit-config.yaml.pre-commit-config.yml
For contributor setup, testing, bundling, and release steps, see CONTRIBUTING.md.