-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpre-commit
More file actions
executable file
·29 lines (25 loc) · 822 Bytes
/
pre-commit
File metadata and controls
executable file
·29 lines (25 loc) · 822 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
LANG=C
# shellcheck source=./shellib/shellib.sh
. "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/shellib/shellib.sh"
# Check committed codebase changes
function run_pre_commit() {
# Skip GitLab CI Linter if GitLab Personal Access Token is not set
if [ -z "${GL_TOKEN:-}" ]; then
if [ -z "${SKIP:-}" ]; then
export SKIP=gitlab-ci-linter
else
export SKIP="$SKIP,gitlab-ci-linter"
fi
else
export GITLAB_PRIVATE_TOKEN="$GL_TOKEN"
fi
pre-commit hook-impl --hook-type=pre-commit --config=.pre-commit-config.yaml --hook-dir "$(cd "$(dirname "$0")" && pwd)" -- "$@"
}
# Skip execution under test
if [ "${BASH_SOURCE[0]}" == "${0}" ]; then
run_pre_commit "$@"
scripts/test tests/fast.set
fi