8 jenkins-job-builder=={env:JJB_VERSION:5.0.2}
10 jenkins-jobs {posargs:--help}
12 [testenv:pre-commit-install]
17 pre-commit install --hook-type commit-msg
19 [testenv:pre-commit-uninstall]
24 pre-commit uninstall --hook-type commit-msg
27 description = Precommit checks for black, gitlint, etc.
34 pre-commit run --all-files --show-diff-on-failure
35 /bin/sh -c 'if ! git config --get user.name > /dev/null; then \
36 git config --global --add user.name "CI"; \
37 touch .git/REMOVE_USERNAME; fi'
38 /bin/sh -c 'if ! git config --get user.email > /dev/null; then \
39 git config --global --add user.email "ci@example.org"; \
40 touch .git/REMOVE_USEREMAIL; fi'
41 /bin/sh -c "if [ -f .git/COMMIT_EDITMSG ]; then \
42 cp .git/COMMIT_EDITMSG .git/COMMIT_MSGTOX; else \
43 git log HEAD -n1 --pretty=%B > .git/COMMIT_MSGTOX; fi"
44 pre-commit run gitlint --hook-stage commit-msg --commit-msg-filename .git/COMMIT_MSGTOX
45 /bin/sh -c "rm -f .git/COMMIT_MSGTOX"
46 /bin/sh -c "if [ -f .git/REMOVE_USERNAME ]; then \
47 git config --global --unset user.name; \
48 rm -f .git/REMOVE_USERNAME; fi"
49 /bin/sh -c "if [ -f .git/REMOVE_USEREMAIL ]; then \
50 git config --global --unset user.email; \
51 rm -f .git/REMOVE_USEREMAIL; fi"