diff --git a/common/scripts/lint-commits b/common/scripts/lint-commits index 01c4eda1700..7207ed81d5a 100755 --- a/common/scripts/lint-commits +++ b/common/scripts/lint-commits @@ -35,18 +35,18 @@ do /^$/ && !msg { msg = 1; next } !msg { next } # 3: long-line-is-banned-except-footnote-like-this-for-url - (NF > 2) && (length > 80) { print C ": long line: " $0; exit 1 } + (NF > 2) && (length > 80) { print "::error title=Commit Lint::" C ": long line: " $0; exit 1 } !subject { - if (length > 50) { print C ": subject is a bit long" } - if (!($0 ~ ":" || $0 ~ "^Take over maintainership " || $0 ~ "^Orphan ")) { print C ": subject does not follow CONTRIBUTING.md guildelines"; exit 1 } + if (length > 50) { print "::warning title=Commit Lint::" C ": subject is a bit long" } + if (!($0 ~ ":" || $0 ~ "^Take over maintainership " || $0 ~ "^Orphan ")) { print "::error title=Commit Lint::" C ": subject does not follow CONTRIBUTING.md guildelines"; exit 1 } # Below check is too noisy? # if (!($0 ~ "^New package:" || $0 ~ ".*: update to")) { - # print C ": not new package/update/removal?" + # print "::warning title=Commit Lint::" C ": not new package/update/removal?" # } subject = 1; next } /^$/ { body = 1; next } - !body { print C ": second line must be blank"; exit 1 } + !body { print "::error title=Commit Lint::" C ": second line must be blank"; exit 1 } ' || status=1 done exit $status diff --git a/common/scripts/lint2annotations.awk b/common/scripts/lint2annotations.awk new file mode 100644 index 00000000000..5405d697153 --- /dev/null +++ b/common/scripts/lint2annotations.awk @@ -0,0 +1,11 @@ +# Converts xlint/etc format lints into GH Actions annotations +# The original line is printed alongside the annotation command +{ + split($0, a, ": ") + split(a[1], b, ":") + msg = substr($0, index($0, ": ") + 2) + if (b[2]) { + line = ",line=" b[2] + } + printf "::error title=Template Lint,file=%s%s::%s\n", b[1], line, msg +} diff --git a/common/travis/xlint.sh b/common/travis/xlint.sh index 6b3d9e91c90..327417c1c32 100755 --- a/common/travis/xlint.sh +++ b/common/travis/xlint.sh @@ -11,7 +11,8 @@ common/scripts/lint-commits $base $tip || EXITCODE=$? for t in $(awk '{ print "srcpkgs/" $0 "/template" }' /tmp/templates); do /bin/echo -e "\x1b[32mLinting $t...\x1b[0m" - xlint "$t" || EXITCODE=$? - common/scripts/lint-version-change "$t" $base $tip || EXITCODE=$? + xlint "$t" > /tmp/xlint_out || EXITCODE=$? + common/scripts/lint-version-change "$t" $base $tip > /tmp/vlint_out || EXITCODE=$? + awk -f common/scripts/lint2annotations.awk /tmp/xlint_out /tmp/vlint_out done exit $EXITCODE