-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitlint.sh
32 lines (26 loc) · 1001 Bytes
/
gitlint.sh
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
#!/bin/sh
# It is only here for reference and backward compatibility, the source of truth
# is Jenkinsfile
# Stop script on NZEC
set -e
# Stop script if unbound variable found (use ${var:-} if intentional)
set -u
# Lines added to get the script running in the script path shell context
# reference: http://www.ostricher.com/2014/10/the-right-way-to-get-the-directory-of-a-bash-script/
cd "$(dirname "$0")"
# To avoid issues with MINGW and Git Bash, see:
# https://github.com/docker/toolbox/issues/673
# https://gist.github.com/borekb/cb1536a3685ca6fc0ad9a028e6a959e3
export MSYS_NO_PATHCONV=1
export MSYS2_ARG_CONV_EXCL="*"
# See more information in https://jorisroovers.com/gitlint
if [ -x "$(command -v gitlint)" ]; then
gitlint --config .gitlint --commits origin/main..HEAD
else
docker run --ulimit nofile=1024 \
-v "$(pwd)/.git":/repo/.git \
-v "$(pwd)/.gitlint":/repo/.gitlint \
jorisroovers/gitlint:0.18.0 \
--config /repo/.gitlint \
--commits origin/main..HEAD
fi