diff options
author | 0x5c <dev@0x5c.io> | 2022-05-02 04:58:34 +0000 |
---|---|---|
committer | Piotr <chocimier@tlen.pl> | 2022-05-05 19:34:11 +0000 |
commit | cc27e8e6f7e9c9c02024d6777896c2ec800b7205 (patch) | |
tree | b553ba273dbca2ca9a744f13404bafa0efc2b95e /common/scripts | |
parent | e900c63cf94fb81468818c09288762716da258fa (diff) | |
download | void-packages-cc27e8e6f7e9c9c02024d6777896c2ec800b7205.tar void-packages-cc27e8e6f7e9c9c02024d6777896c2ec800b7205.tar.gz void-packages-cc27e8e6f7e9c9c02024d6777896c2ec800b7205.tar.bz2 void-packages-cc27e8e6f7e9c9c02024d6777896c2ec800b7205.tar.lz void-packages-cc27e8e6f7e9c9c02024d6777896c2ec800b7205.tar.xz void-packages-cc27e8e6f7e9c9c02024d6777896c2ec800b7205.tar.zst void-packages-cc27e8e6f7e9c9c02024d6777896c2ec800b7205.zip |
common/travis/xlint.sh: print Github annotations
Turns xlint, version lint, and commit lint messages into warning or error
annotaions. All are printed with special highlighting in the action log and
summary. Xlint and version lint annotations are shown inline in the changes tab
and commit view. Annotations without line number are shown at line 1.
Diffstat (limited to 'common/scripts')
-rwxr-xr-x | common/scripts/lint-commits | 10 | ||||
-rw-r--r-- | common/scripts/lint2annotations.awk | 11 |
2 files changed, 16 insertions, 5 deletions
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 +} |