diff --git a/dist/tools/pr_check/check.sh b/dist/tools/pr_check/check.sh index ef4f631bf1..b00f428fa3 100755 --- a/dist/tools/pr_check/check.sh +++ b/dist/tools/pr_check/check.sh @@ -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}