From b47f8fb264b979e0d6cf2cb7bd8a08a2e2a8d919 Mon Sep 17 00:00:00 2001 From: Ryan Delaney Date: Wed, 9 Mar 2022 11:33:26 -0500 Subject: [PATCH] Add github action for pre-commit checks --- .github/workflows/build.yml | 4 +++- .github/workflows/pre_commit.yaml | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pre_commit.yaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f0f410d..4a3992a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,6 @@ +--- name: 'Release' + on: push: branches: [master] @@ -8,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Check out Git repository' - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: 'Generate shell files' run: make generate diff --git a/.github/workflows/pre_commit.yaml b/.github/workflows/pre_commit.yaml new file mode 100644 index 0000000..2aa217e --- /dev/null +++ b/.github/workflows/pre_commit.yaml @@ -0,0 +1,26 @@ +--- +name: pre-commit + +on: + pull_request: + push: + branches: [main] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Install pre-commit + run: pip install pre-commit + + - name: cache + uses: actions/cache@v2 + with: + key: pre-commit-dot-cache-{{ checksum ".pre-commit-config.yaml" }} + path: ~/.cache/pre-commit + + - name: Pre-commit checks + run: pre-commit run --all-files --show-diff-on-failure