Skip to content

Commit 4165ea0

Browse files
L-seriesmkannwischer
authored andcommitted
CI: lint: output errors
This commit accumulates the names of the checks which have failed while linting and exposes them to the outer context window in order to guide the user. Signed-off-by: Andreas Hatziiliou <andreas.hatziiliou@savoirfairelinux.com>
1 parent 7303bac commit 4165ea0

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

scripts/lint

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ GREEN="\033[32m"
2222
RED="\033[31m"
2323
NORMAL="\033[0m"
2424

25+
# Global error info
26+
ERROR_LOG=""
27+
2528
info()
2629
{
2730
printf "%b %b\n" "${GREEN}" "${NORMAL}${*}"
@@ -86,6 +89,7 @@ gh_summary_failure()
8689
{
8790
if $IN_GITHUB_CONTEXT; then
8891
echo ":x: $1" >>"$GITHUB_STEP_SUMMARY"
92+
ERROR_LOG+=" - $1"$'\n'
8993
fi
9094
}
9195

@@ -236,6 +240,7 @@ check-spdx()
236240
error "Check SPDX + Copyright"
237241
SUCCESS=false
238242
gh_summary_failure "Check SPDX + Copyright"
243+
239244
fi
240245
}
241246
gh_group_start "Checking SPDX + Copyright headers"
@@ -274,10 +279,6 @@ gh_group_start "Check magic constants"
274279
check-magic
275280
gh_group_end
276281

277-
if ! $SUCCESS; then
278-
exit 1
279-
fi
280-
281282
check-contracts()
282283
{
283284
if python3 "$ROOT"/scripts/check-contracts >/dev/null; then
@@ -295,5 +296,9 @@ check-contracts
295296
gh_group_end
296297

297298
if ! $SUCCESS; then
299+
if $IN_GITHUB_CONTEXT; then
300+
printf "%b%s%b\n" "${RED}" "The following checks failed, expand each for more details." "${NORMAL}"
301+
echo "$ERROR_LOG"
302+
fi
298303
exit 1
299304
fi

0 commit comments

Comments
 (0)