Added pre-commit job (#1)

This commit is contained in:
Alejandro Angulo 2023-02-13 10:18:39 -08:00 committed by GitHub
parent 65834d0ff6
commit 866b5df41b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 1 deletions

View file

@ -15,6 +15,7 @@
"latexindent", "latexindent",
"latexmk", "latexmk",
"PHONENUMBER", "PHONENUMBER",
"shellcheck",
"texlab", "texlab",
"toolset" "toolset"
], ],

View file

@ -1,7 +1,6 @@
name: "Build" name: "Build"
on: on:
pull_request: pull_request:
push:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -11,3 +10,23 @@ jobs:
- run: nix build - run: nix build
- run: nix flake check - run: nix flake check
- run: nix run - 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"

View file

@ -21,3 +21,8 @@ repos:
entry: chktex entry: chktex
language: system language: system
types: [tex] types: [tex]
- id: shellcheck
name: shellcheck
entry: shellcheck
language: system
types: [shell]