forked from jobtome-labs/ci-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lint-yaml.yml
44 lines (38 loc) · 1.03 KB
/
lint-yaml.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
37
38
39
40
41
42
43
44
lint:yaml:
stage: lint
image: gdiener/yamllint-reviewdog:v1.0.0
variables:
GITLAB_API: ${CI_API_V4_URL}
script:
- |
if [[ -z "${LINT_PATH}" ]]; then
LINT_PATH="."
fi
echo
echo "-> Linting YAML files:"
echo
if [ "${ENABLE_REVIEWDOG}" = "1" ]; then
echo
echo "-> Enabled Review Dog!"
echo
if [ -z "${REVIEWDOG_GITLAB_API_TOKEN}" ]; then
echo
echo "-> [WARNING] Missing 'REVIEWDOG_GITLAB_API_TOKEN' variable!"
echo
exit 1
fi
if [ -z "${REVIEWDOG_LEVEL}" ]; then
REVIEWDOG_LEVEL="warning"
fi
yamllint --format "parsable" "${LINT_PATH}" | reviewdog -name="YAML Linter" \
-efm="%f:%l:%c: %m" -diff="git diff master" -reporter=gitlab-mr-discussion -level="${INPUT_LEVEL}"
else
yamllint "${LINT_PATH}"
fi
echo
echo "-> YAML files checked!"
echo
except:
variables:
- $SKIP_CI_LINT == "true"
- $CI_FAST_TRACK == "true"