-
Notifications
You must be signed in to change notification settings - Fork 1
36 lines (36 loc) · 1.09 KB
/
pre-commit.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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@v2
- name: Install pre-commit
run: pip install "pre-commit==2.20.0"
- 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 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;
}