Added pre-commit job (#1)
This commit is contained in:
parent
65834d0ff6
commit
866b5df41b
3 changed files with 26 additions and 1 deletions
21
.github/workflows/build.yml
vendored
21
.github/workflows/build.yml
vendored
|
@ -1,7 +1,6 @@
|
|||
name: "Build"
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -11,3 +10,23 @@ jobs:
|
|||
- run: nix build
|
||||
- run: nix flake check
|
||||
- run: nix run
|
||||
|
||||
pre-commit-hooks:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: cachix/install-nix-action@v19
|
||||
|
||||
- run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
|
||||
|
||||
- name: Cache pre-commit environment
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.cache/pre-commit
|
||||
key: pre-commit-${{ env.PY }}-${{ hashFiles('.pre-commit-config.yaml') }}
|
||||
|
||||
- name: Run pre-commit hooks
|
||||
run: nix develop --command -- pre-commit run --show-diff-on-failure --color=always --from-ref origin/main --to-ref "$GITHUB_SHA"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue