Skip to content

Commit 7389dd2

Browse files
authored
Merge pull request #14647 from vojtapolasek/fix_aborted_yamllint
yamllint: prevent the script from being killed before we get output
2 parents f770821 + 1d1feee commit 7389dd2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

.github/workflows/ci_lint.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ jobs:
4444
if grep -qP '\{\{[%{#]' "$file"; then
4545
# File contains Jinja2 constructs — strip them before linting.
4646
# yamllint -s exits: 0 = clean, 1 = errors, 2 = warnings only.
47+
# Use "|| rc=$?" to prevent set -e from killing the script before
48+
# we can capture the exit code and print the diagnostic output.
49+
rc=0
4750
output=$(python3 utils/strip_jinja_for_yamllint.py "$file" \
48-
| yamllint -s -c .yamllint - 2>&1)
49-
rc=$?
51+
| yamllint -s -c .yamllint - 2>&1) || rc=$?
5052
# Show all output (warnings and errors), replacing "stdin"
5153
# with the actual filename since yamllint reads from a pipe.
5254
if [ -n "$output" ]; then
@@ -57,8 +59,8 @@ jobs:
5759
exit_code=1
5860
fi
5961
else
60-
yamllint -s -c .yamllint "$file"
61-
rc=$?
62+
rc=0
63+
yamllint -s -c .yamllint "$file" || rc=$?
6264
if [ "$rc" -eq 1 ]; then
6365
exit_code=1
6466
fi

0 commit comments

Comments
 (0)