Merge branch 'develop' #113
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: pre-commit checks | |
| on: [push, pull_request] | |
| jobs: | |
| pre-commit: | |
| runs-on: ubuntu-latest | |
| container: python:3 | |
| steps: | |
| - name: Check out repository code | |
| uses: actions/checkout@v3 | |
| - name: Add the project directory to safe directories in Git | |
| run: git config --global --add safe.directory "${GITHUB_WORKSPACE}" | |
| - name: Install pre-commit | |
| run: pip install "pre-commit==4.0.1" | |
| - name: Run pre-commit checks | |
| run: | | |
| TMP_MSG_FILE="$(mktemp)" && | |
| git log -1 --pretty=%B > "${TMP_MSG_FILE}" && | |
| pre-commit run \ | |
| --all-files \ | |
| --color=always \ | |
| --show-diff-on-failure \ | |
| --hook-stage pre-commit && | |
| pre-commit run \ | |
| --all-files \ | |
| --color=always \ | |
| --show-diff-on-failure \ | |
| --hook-stage commit-msg \ | |
| --commit-msg-filename "${TMP_MSG_FILE}" && | |
| pre-commit run \ | |
| --all-files \ | |
| --color=always \ | |
| --show-diff-on-failure \ | |
| --hook-stage post-commit || | |
| { | |
| >&2 echo "pre-commit checks failed. Please consider installing pre-commit"; | |
| >&2 echo "hooks in your local Git clone by running \`make git-hooks-install\`."; | |
| exit 1; | |
| } |