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