1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

dist/tools/pr_check: annotate errors in Github Action

This commit is contained in:
Martine Lenders 2021-01-08 15:26:52 +01:00
parent 375df5740a
commit d4628dc07f
No known key found for this signature in database
GPG Key ID: CCD317364F63286F

View File

@ -7,6 +7,8 @@
# directory for more details.
#
. "$(dirname "$0")/../ci/github_annotate.sh"
: "${RIOTBASE:=$(cd $(dirname $0)/../../../; pwd)}"
cd $RIOTBASE
@ -14,6 +16,8 @@ cd $RIOTBASE
EXIT_CODE=0
github_annotate_setup
if tput colors &> /dev/null && [ $(tput colors) -ge 8 ]; then
CERROR="\e[1;31m"
CRESET="\e[0m"
@ -39,9 +43,24 @@ SQUASH_COMMITS="$(git log $(git merge-base HEAD "${RIOT_MASTER}")...HEAD --prett
keyword_filter)"
if [ -n "${SQUASH_COMMITS}" ]; then
echo -e "${CERROR}Pull request needs squashing:${CRESET}" 1>&2
echo -e "${SQUASH_COMMITS}"
if github_annotate_is_on; then
echo "${SQUASH_COMMITS}" | while read commit; do
ANNOTATION="Commit needs to be squashed: \"${commit}\""
ANNOTATION="${ANNOTATION}\n\nPLEASE ONLY SQUASH WHEN ASKED BY A "
ANNOTATION="${ANNOTATION}MAINTAINER!"
ANNOTATION="${ANNOTATION}\nSee: "
ANNOTATION="${ANNOTATION}https://github.com/RIOT-OS/RIOT/blob/master/CONTRIBUTING.md#squash-commits-after-review"
github_annotate_error_no_file "${ANNOTATION}"
done
else
echo -e "${CERROR}Pull request needs squashing:${CRESET}" 1>&2
echo -e "${SQUASH_COMMITS}"
fi
EXIT_CODE=1
fi
github_annotate_teardown
github_annotate_report_last_run
exit ${EXIT_CODE}