diff --git a/.github/actions/pre-commit/action.yml b/.github/actions/pre-commit/action.yml new file mode 100644 index 0000000..f44e69f --- /dev/null +++ b/.github/actions/pre-commit/action.yml @@ -0,0 +1,22 @@ +name: run pre-commit checks +description: run all pre-commit managed checks +inputs: + pre-commit-home: + description: cache dir to use + required: true + default: ${{ github.workspace }}/.pre-commit-cache +runs: + using: "composite" + steps: + - id: python-interpreter-hash + shell: bash + run: echo "HASH=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_OUTPUTS + - uses: actions/cache@v4 + with: + path: ${{ inputs.pre-commit-home }} + key: pre-commit|${{ steps.python-interpreter-hash.outputs.HASH }}|${{ hashFiles('.pre-commit-config.yaml') }} + - name: Run commit checks + shell: bash + env: + PRE_COMMIT_HOME: ${{ inputs.pre-commit-home }} + run: poetry run pre-commit run -a diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 9d0dccf..fcba8ab 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -17,6 +17,6 @@ jobs: - name: Install dependencies run: poetry install --with=dev - name: Run commit checks - run: poetry run pre-commit run -a + uses: ./.github/actions/pre-commit - name: Run tests run: ./scripts/test