From aece264ada7dafe162f5337562f09349a5ff4f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Boulle?= Date: Thu, 12 Nov 2020 08:53:07 +0100 Subject: [PATCH 01/22] feat(revert): allow to not specify the reverted commit sha1 With github revert no sha1 is specified, thus we don't the validator to fail on this revert. --- README.md | 9 +++++++-- action.yml | 4 ++++ check_message.sh | 7 ++++++- validator.bats | 13 +++++++++++++ validator.sh | 4 ++++ 5 files changed, 34 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f5649f8..7a18283 100644 --- a/README.md +++ b/README.md @@ -233,6 +233,8 @@ in `.git/hooks` directory of your repository. no validation is done on JIRA refs. - if `COMMIT_VALIDATOR_ALLOW_TEMP` environment variable is not empty, no validation is done on `fixup!` and `squash!` commits. +- if `COMMIT_VALIDATOR_NO_REVERT_SHA1` environment variable is not empty, + no validation is done revert commits. ### Commit template @@ -276,6 +278,8 @@ jobs: - if `no_jira` is not empty, no validation is done on JIRA refs. - if `allow_temp` is not empty, no validation is done on `fixup!` and `squash!` commits. +- if `no_revert_sha1` is not empty, no validation is done on revert + commits. ## Add pre-commit plugin @@ -303,9 +307,10 @@ Then run `pre-commit install --hook-type commit-msg` to install the ### Pre commit hook options -- if `no_jira` is set, no validation is done on JIRA refs. -- if `allow_temp` is set, no validation is done on `fixup!` and `squash!` +- if `no-jira` is set, no validation is done on JIRA refs. +- if `allow-temp` is set, no validation is done on `fixup!` and `squash!` commits. +- if `no-revert-sha1` is set, no validation is done on revert commits. diff --git a/action.yml b/action.yml index d28f51a..187b510 100644 --- a/action.yml +++ b/action.yml @@ -13,6 +13,9 @@ inputs: allow_temp: description: 'If not empty, no validation is done on `fixup!` and `squash!` commits.' required: false + no_revert_sha1: + description: 'If not empty, reverted sha1 commit is not mandatory in revert commit message.' + required: false runs: using: "composite" steps: @@ -31,4 +34,5 @@ runs: env: COMMIT_VALIDATOR_NO_JIRA: ${{ inputs.no_jira }} COMMIT_VALIDATOR_ALLOW_TEMP: ${{ inputs.allow_temp }} + COMMIT_VALIDATOR_NO_REVERT_SHA1: ${{ inputs.no_revert_sha1 }} shell: bash diff --git a/check_message.sh b/check_message.sh index 1691dd0..d22aa43 100755 --- a/check_message.sh +++ b/check_message.sh @@ -10,11 +10,13 @@ OPTIONS=$(getopt --long no-jira allow-temp -- "$@") COMMIT_VALIDATOR_ALLOW_TEMP= COMMIT_VALIDATOR_NO_JIRA= +COMMIT_VALIDATOR_NO_REVERT_SHA1= while true; do case "$1" in --no-jira ) COMMIT_VALIDATOR_NO_JIRA=1; shift ;; --allow-temp ) COMMIT_VALIDATOR_ALLOW_TEMP=1; shift ;; + --no-revert-sha1 ) COMMIT_VALIDATOR_NO_REVERT_SHA1=1; shift ;; -- ) shift; break ;; * ) break ;; esac @@ -44,7 +46,10 @@ fi # print message so you don't lose it in case of errors # (in case you are not using `-m` option) -echo "Options: JIRA=$COMMIT_VALIDATOR_NO_JIRA, TEMP=$COMMIT_VALIDATOR_ALLOW_TEMP" +echo "Options: " +echo " JIRA=$COMMIT_VALIDATOR_NO_JIRA" +echo " TEMP=$COMMIT_VALIDATOR_ALLOW_TEMP" +echo " NO_REVERT_SHA1=$COMMIT_VALIDATOR_NO_REVERT_SHA1" printf "checking commit message:\n\n#BEGIN#\n%s\n#END#\n\n" "$MESSAGE" validate "$MESSAGE" diff --git a/validator.bats b/validator.bats index 0cddb49..9f2a1e5 100644 --- a/validator.bats +++ b/validator.bats @@ -472,6 +472,8 @@ LUM-2345' run validate_revert "$MESSAGE" [[ "$status" -eq $ERROR_REVERT ]] + COMMIT_VALIDATOR_NO_REVERT_SHA1= run validate_revert "$MESSAGE" + [[ "$status" -eq $ERROR_REVERT ]] } @test "revert body with commit sha1 should be valid" { @@ -483,6 +485,17 @@ LUM-2345' run validate_revert "$MESSAGE" [[ "$status" -eq 0 ]] + COMMIT_VALIDATOR_NO_REVERT_SHA1= run validate_revert "$MESSAGE" + [[ "$status" -eq 0 ]] +} + +@test "revert body without sha1 should be valid with the flag" { + MESSAGE='rerer + +LUM-2345' + + COMMIT_VALIDATOR_NO_REVERT_SHA1=1 run validate_revert "$MESSAGE" + [[ "$status" -eq 0 ]] } @test "features and fixes commits need jira reference" { diff --git a/validator.sh b/validator.sh index 6145b0e..c4c7317 100644 --- a/validator.sh +++ b/validator.sh @@ -242,6 +242,10 @@ validate_revert() { local LINE="" local REVERTED_COMMIT="" + if [[ ! -z "${COMMIT_VALIDATOR_NO_REVERT_SHA1:-}" ]]; then + exit 0 + fi + while IFS= read -r LINE ; do if [[ $LINE =~ $REVERT_COMMIT_PATTERN ]]; then From 5c8c2014a7717e6e5b9aedded10bb507b87aad65 Mon Sep 17 00:00:00 2001 From: Jan Villeminot Date: Tue, 23 Feb 2021 16:06:29 +0100 Subject: [PATCH 02/22] feat(jira): make jira types an option --- validator.bats | 16 ++++++++-------- validator.sh | 23 +++++++++++------------ 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/validator.bats b/validator.bats index 9f2a1e5..e827c5f 100644 --- a/validator.bats +++ b/validator.bats @@ -499,23 +499,23 @@ LUM-2345' } @test "features and fixes commits need jira reference" { - [[ `need_jira "feat"` -eq 1 ]] - [[ `need_jira "fix"` -eq 1 ]] + need_jira "feat" + need_jira "fix" } @test "features and fixes commits need jira reference if env empty" { - [[ `COMMIT_VALIDATOR_NO_JIRA= need_jira "feat"` -eq 1 ]] - [[ `COMMIT_VALIDATOR_NO_JIRA= need_jira "fix"` -eq 1 ]] + COMMIT_VALIDATOR_NO_JIRA= need_jira "feat" + COMMIT_VALIDATOR_NO_JIRA= need_jira "fix" } @test "features and fixes commits don't need jira reference if env non empty" { - [[ `COMMIT_VALIDATOR_NO_JIRA=1 need_jira "feat"` -eq 0 ]] - [[ `COMMIT_VALIDATOR_NO_JIRA=1 need_jira "fix"` -eq 0 ]] + ! COMMIT_VALIDATOR_NO_JIRA=1 need_jira "feat" + ! COMMIT_VALIDATOR_NO_JIRA=1 need_jira "fix" } @test "other commits don't need jira reference" { - [[ `need_jira "docs"` -eq 0 ]] - [[ `need_jira "test"` -eq 0 ]] + ! need_jira "docs" + ! need_jira "test" } @test "feat without jira ref should be rejected" { diff --git a/validator.sh b/validator.sh index c4c7317..d652cf5 100644 --- a/validator.sh +++ b/validator.sh @@ -29,6 +29,7 @@ readonly ERROR_REVERT=10 GLOBAL_HEADER="" GLOBAL_BODY="" GLOBAL_JIRA="" +GLOBAL_JIRA_TYPES="${GLOBAL_JIRA_TYPES:-feat fix}" GLOBAL_FOOTER="" GLOBAL_TYPE="" @@ -212,18 +213,14 @@ need_jira() { local TYPE=$1 if [[ ! -z "${COMMIT_VALIDATOR_NO_JIRA:-}" ]]; then - echo 0 + return 1 else - case $TYPE in - feat) - echo 1 - ;; - fix) - echo 1 - ;; - *) - echo 0 - esac + for type in ${GLOBAL_JIRA_TYPES}; do + if [[ "${TYPE}" == "${type}" ]]; then + return 0 + fi + done + return 1 fi } @@ -231,7 +228,9 @@ validate_jira() { local TYPE=$1 local JIRA=$2 - if [[ "$(need_jira "$TYPE")" -eq "1" && -z "${JIRA:-}" ]]; then + + + if need_jira "$TYPE" && [[ -z "${JIRA:-}" ]]; then echo -e "commits with type '${TYPE}' need to include a reference to a JIRA ticket, by adding the project prefix and the issue number to the commit message, this could be done easily with: git commit -m 'feat(widget): add a wonderful widget' -m LUM-1234" exit $ERROR_JIRA fi From 6d183af77652dab991f2057c88528f519acd7bc5 Mon Sep 17 00:00:00 2001 From: Jan Villeminot Date: Tue, 23 Feb 2021 16:18:12 +0100 Subject: [PATCH 03/22] feat(length): make the length configurable also better the shell in the function --- validator.bats | 4 ++++ validator.sh | 9 +++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/validator.bats b/validator.bats index e827c5f..ea3759c 100644 --- a/validator.bats +++ b/validator.bats @@ -328,6 +328,10 @@ BROKEN: [ "$status" -eq $ERROR_HEADER_LENGTH ] } +@test "header length cannot be more than 150 with spaces. overriden" { + GLOBAL_MAX_LENGTH=150 validate_header_length "012345678 012345678 012345678 012345678 012345678 012345678 012345678 1" +} + @test "header length can be 70" { run validate_header_length "0123456789012345678901234567890123456789012345678901234567890123456789" [ "$status" -eq 0 ] diff --git a/validator.sh b/validator.sh index d652cf5..d353e78 100644 --- a/validator.sh +++ b/validator.sh @@ -30,6 +30,7 @@ GLOBAL_HEADER="" GLOBAL_BODY="" GLOBAL_JIRA="" GLOBAL_JIRA_TYPES="${GLOBAL_JIRA_TYPES:-feat fix}" +GLOBAL_MAX_LENGTH="${GLOBAL_MAX_LENGTH:-70}" GLOBAL_FOOTER="" GLOBAL_TYPE="" @@ -142,12 +143,8 @@ validate_header() { validate_header_length() { local HEADER="$1" - local LENGTH - - LENGTH="$(echo -n "$HEADER" | wc -c)" - - if [[ $LENGTH -gt 70 ]]; then - echo -e "commit header length is more than 70 charaters" + if [[ ${#HEADER} -gt ${GLOBAL_MAX_LENGTH} ]]; then + echo -e "commit header length is more than ${GLOBAL_MAX_LENGTH} characters" exit $ERROR_HEADER_LENGTH fi } From 36d53d386d15069fbf56dacc29c42e36c0309907 Mon Sep 17 00:00:00 2001 From: Jan Villeminot Date: Tue, 23 Feb 2021 16:36:46 +0100 Subject: [PATCH 04/22] feat(types): allow for a gen type when we generate configuration --- validator.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validator.sh b/validator.sh index d353e78..d187381 100644 --- a/validator.sh +++ b/validator.sh @@ -5,7 +5,7 @@ if [[ -v ZSH_NAME ]]; then fi readonly HEADER_PATTERN="^([^\(]+)\(([^\)]+)\): (.+)$" -readonly TYPE_PATTERN="^(feat|fix|docs|lint|refactor|test|chore)$" +readonly TYPE_PATTERN="^(feat|fix|docs|gen|lint|refactor|test|chore)$" readonly SCOPE_PATTERN="^([a-z][a-z0-9]*)(-[a-z0-9]+)*$" readonly SUBJECT_PATTERN="^([a-z0-9].*[^ ^\.])$" readonly JIRA_PATTERN="^([A-Z]{2,4}-[0-9]{1,6} ?)+$" From ad13636b606d202c776c4a4290139e01a7c46420 Mon Sep 17 00:00:00 2001 From: Jan Villeminot Date: Tue, 23 Feb 2021 17:29:09 +0100 Subject: [PATCH 05/22] feat(jira): jira ref in header --- validator.bats | 12 ++++++++++++ validator.sh | 11 +++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/validator.bats b/validator.bats index ea3759c..20d98bd 100644 --- a/validator.bats +++ b/validator.bats @@ -97,6 +97,18 @@ ABC-1234" [[ $GLOBAL_FOOTER == "" ]] } +@test "structure: valid commit message with JIRA in header" { + COMMIT="feat(abc): ABC-1234 + +plop" + + GLOBAL_JIRA_IN_HEADER="allow" validate_overall_structure "$COMMIT" + [[ $GLOBAL_HEADER == "feat(abc): ABC-1234" ]] + [[ $GLOBAL_JIRA == "ABC-1234" ]] + [[ $GLOBAL_BODY == "plop"$'\n' ]] + [[ $GLOBAL_FOOTER == "" ]] +} + @test "structure: valid commit message with header and multiple JIRA" { COMMIT="plop plop diff --git a/validator.sh b/validator.sh index d187381..603031c 100644 --- a/validator.sh +++ b/validator.sh @@ -8,7 +8,8 @@ readonly HEADER_PATTERN="^([^\(]+)\(([^\)]+)\): (.+)$" readonly TYPE_PATTERN="^(feat|fix|docs|gen|lint|refactor|test|chore)$" readonly SCOPE_PATTERN="^([a-z][a-z0-9]*)(-[a-z0-9]+)*$" readonly SUBJECT_PATTERN="^([a-z0-9].*[^ ^\.])$" -readonly JIRA_PATTERN="^([A-Z]{2,4}-[0-9]{1,6} ?)+$" +readonly JIRA_PATTERN="^([A-Z]{3,4}-[0-9]{1,6} ?)+$" +readonly JIRA_HEADER_PATTERN="^.*([A-Z]{3,4}-[0-9]{1,6}).*$" readonly BROKE_PATTERN="^BROKEN:$" readonly TRAILING_SPACE_PATTERN=" +$" readonly REVERT_HEADER_PATTERN="^[R|r]evert[: ].*$" @@ -29,9 +30,12 @@ readonly ERROR_REVERT=10 GLOBAL_HEADER="" GLOBAL_BODY="" GLOBAL_JIRA="" +GLOBAL_FOOTER="" + +# Overridable variables GLOBAL_JIRA_TYPES="${GLOBAL_JIRA_TYPES:-feat fix}" GLOBAL_MAX_LENGTH="${GLOBAL_MAX_LENGTH:-70}" -GLOBAL_FOOTER="" +GLOBAL_JIRA_IN_HEADER="${GLOBAL_JIRA_IN_HEADER:-}" GLOBAL_TYPE="" GLOBAL_SCOPE="" @@ -54,6 +58,9 @@ validate_overall_structure() { if [[ $STATE -eq $WAITING_HEADER ]]; then GLOBAL_HEADER="$LINE" STATE="$WAITING_EMPTY" + if [[ -n "${GLOBAL_JIRA_IN_HEADER:-}" ]] && [[ $LINE =~ $JIRA_HEADER_PATTERN ]]; then + GLOBAL_JIRA=${BASH_REMATCH[1]} + fi elif [[ $STATE -eq $WAITING_EMPTY ]]; then if [[ $LINE != "" ]]; then From 0579955c2d12d2522e4bb109585906795fcb52f4 Mon Sep 17 00:00:00 2001 From: Jan Villeminot Date: Tue, 23 Feb 2021 18:07:58 +0100 Subject: [PATCH 06/22] feat(pre-commit): adding new options to the pre-commit shell script Also making the whole thing posix when handling arguments as not being able to put = between args and values was frustrating --- README.md | 3 +++ check_message.sh | 20 +++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 7a18283..758c55b 100644 --- a/README.md +++ b/README.md @@ -311,6 +311,9 @@ Then run `pre-commit install --hook-type commit-msg` to install the - if `allow-temp` is set, no validation is done on `fixup!` and `squash!` commits. - if `no-revert-sha1` is set, no validation is done on revert commits. +- if `--jira-in-header` jira reference can be put in the commit header. +- `--header-length` allow to override the max length of the header line. +- `--jira-types` takes a space separated list `"feat fix"` as a parameter to override the default types requiring a jira diff --git a/check_message.sh b/check_message.sh index d22aa43..72478f5 100755 --- a/check_message.sh +++ b/check_message.sh @@ -2,21 +2,19 @@ set -eu -OPTIONS=$(getopt --long no-jira allow-temp -- "$@") -[ $? -eq 0 ] || { - echo "Incorrect options provided" - exit 1 -} +OPTIONS=$(getopt --long no-jira,allow-temp,jira-in-header,header-length:,jira-types: -- "$@") -COMMIT_VALIDATOR_ALLOW_TEMP= -COMMIT_VALIDATOR_NO_JIRA= -COMMIT_VALIDATOR_NO_REVERT_SHA1= +unset COMMIT_VALIDATOR_ALLOW_TEMP COMMIT_VALIDATOR_NO_JIRA COMMIT_VALIDATOR_NO_REVERT_SHA1 GLOBAL_JIRA_IN_HEADER GLOBAL_MAX_LENGTH GLOBAL_JIRA_TYPES +eval set -- $OPTIONS while true; do case "$1" in --no-jira ) COMMIT_VALIDATOR_NO_JIRA=1; shift ;; --allow-temp ) COMMIT_VALIDATOR_ALLOW_TEMP=1; shift ;; --no-revert-sha1 ) COMMIT_VALIDATOR_NO_REVERT_SHA1=1; shift ;; + --jira-in-header ) GLOBAL_JIRA_IN_HEADER=1; shift ;; + --header-length ) GLOBAL_MAX_LENGTH="$2"; shift 2 ;; + --jira-types ) GLOBAL_JIRA_TYPES="$2"; shift 2 ;; -- ) shift; break ;; * ) break ;; esac @@ -47,9 +45,9 @@ fi # print message so you don't lose it in case of errors # (in case you are not using `-m` option) echo "Options: " -echo " JIRA=$COMMIT_VALIDATOR_NO_JIRA" -echo " TEMP=$COMMIT_VALIDATOR_ALLOW_TEMP" -echo " NO_REVERT_SHA1=$COMMIT_VALIDATOR_NO_REVERT_SHA1" +echo " JIRA=${COMMIT_VALIDATOR_NO_JIRA:-}" +echo " TEMP=${COMMIT_VALIDATOR_ALLOW_TEMP:-}" +echo " NO_REVERT_SHA1=${COMMIT_VALIDATOR_NO_REVERT_SHA1:-}" printf "checking commit message:\n\n#BEGIN#\n%s\n#END#\n\n" "$MESSAGE" validate "$MESSAGE" From ca118a1a3b73937f53a2cfe490cefd38ce96ac6c Mon Sep 17 00:00:00 2001 From: Laurent Date: Thu, 4 Mar 2021 14:39:30 +0100 Subject: [PATCH 07/22] fix(jira): allow jira ref with shorter prefix --- validator.bats | 9 +++++++-- validator.sh | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/validator.bats b/validator.bats index 20d98bd..60c7bbc 100644 --- a/validator.bats +++ b/validator.bats @@ -112,12 +112,12 @@ plop" @test "structure: valid commit message with header and multiple JIRA" { COMMIT="plop plop -ABC-1234 DEF-1234" +ABC-1234 DE-1234" validate_overall_structure "$COMMIT" [[ $GLOBAL_HEADER == "plop plop" ]] [[ $GLOBAL_BODY == "" ]] - [[ $GLOBAL_JIRA == "ABC-1234 DEF-1234" ]] + [[ $GLOBAL_JIRA == "ABC-1234 DE-1234" ]] [[ $GLOBAL_FOOTER == "" ]] } @@ -549,6 +549,11 @@ LUM-2345' [[ "$status" -eq 0 ]] } +@test "feat with short jira ref should be validated" { + run validate_jira "feat" "AB-123" + [[ "$status" -eq 0 ]] +} + @test "overall validation invalid structure" { MESSAGE='plop plop' diff --git a/validator.sh b/validator.sh index 603031c..583e6f7 100644 --- a/validator.sh +++ b/validator.sh @@ -8,7 +8,7 @@ readonly HEADER_PATTERN="^([^\(]+)\(([^\)]+)\): (.+)$" readonly TYPE_PATTERN="^(feat|fix|docs|gen|lint|refactor|test|chore)$" readonly SCOPE_PATTERN="^([a-z][a-z0-9]*)(-[a-z0-9]+)*$" readonly SUBJECT_PATTERN="^([a-z0-9].*[^ ^\.])$" -readonly JIRA_PATTERN="^([A-Z]{3,4}-[0-9]{1,6} ?)+$" +readonly JIRA_PATTERN="^([A-Z]{2,4}-[0-9]{1,6} ?)+$" readonly JIRA_HEADER_PATTERN="^.*([A-Z]{3,4}-[0-9]{1,6}).*$" readonly BROKE_PATTERN="^BROKEN:$" readonly TRAILING_SPACE_PATTERN=" +$" From c9760ea4fb060cb5a6195bc6d5aa65f9fcaefcb8 Mon Sep 17 00:00:00 2001 From: Laurent Date: Thu, 4 Mar 2021 14:40:41 +0100 Subject: [PATCH 08/22] chore(validator): fix tiny typos --- check.sh | 2 +- git-commit-template | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/check.sh b/check.sh index 8b914b2..7f9ee15 100755 --- a/check.sh +++ b/check.sh @@ -20,4 +20,4 @@ do validate "$MESSAGE" done <<< $COMMITS -echo "All commits succesfully checked" +echo "All commits successfully checked" diff --git a/git-commit-template b/git-commit-template index bfe2a5a..126f1ee 100644 --- a/git-commit-template +++ b/git-commit-template @@ -22,8 +22,8 @@ type(scope): subject # kebab-case. ## Subject -# A brief but meaningfull description of the change. Here are some -# recommandation for writing your subject: +# A brief but meaningful description of the change. Here are some +# recommendation for writing your subject: # - use the imperative, present tense: "change" not "changed" nor "changes" # - don't capitalize first letter # - no "." (dot) at the end From e3020bccb4a28800dcbacb1a3d7a649d223f86f0 Mon Sep 17 00:00:00 2001 From: Jan Villeminot Date: Mon, 8 Mar 2021 19:21:20 +0100 Subject: [PATCH 09/22] chore(github-action): add new options to github-action --- README.md | 3 +++ action.yml | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/README.md b/README.md index 758c55b..a83e095 100644 --- a/README.md +++ b/README.md @@ -280,6 +280,9 @@ jobs: and `squash!` commits. - if `no_revert_sha1` is not empty, no validation is done on revert commits. +- `jira_in_header` jira reference can be put in the commit header. +- `header_length` allow to override the max length of the header line. +- `jira_types` takes a space separated list `"feat fix"` as a parameter to override the default types requiring a jira ## Add pre-commit plugin diff --git a/action.yml b/action.yml index 187b510..34d981c 100644 --- a/action.yml +++ b/action.yml @@ -16,6 +16,15 @@ inputs: no_revert_sha1: description: 'If not empty, reverted sha1 commit is not mandatory in revert commit message.' required: false + header_length: + description: 'If not empty, max header_length' + required: false + jira_types: + description: 'If not empty, space separated list of types that require Jira refs' + required: false + jira_in_header: + description: 'If not empty, allow for jira ref in header' + required: false runs: using: "composite" steps: @@ -35,4 +44,7 @@ runs: COMMIT_VALIDATOR_NO_JIRA: ${{ inputs.no_jira }} COMMIT_VALIDATOR_ALLOW_TEMP: ${{ inputs.allow_temp }} COMMIT_VALIDATOR_NO_REVERT_SHA1: ${{ inputs.no_revert_sha1 }} + GLOBAL_JIRA_TYPES: ${{ inputs.jira_types }} + GLOBAL_MAX_LENGTH: ${{ inputs.header_length }} + GLOBAL_JIRA_IN_HEADER: ${{ inputs.jira_in_header }} shell: bash From 2ffd5a5c8c8c4efe1235c75be5d1a5ae23aaf9ae Mon Sep 17 00:00:00 2001 From: Jan Villeminot Date: Tue, 9 Mar 2021 09:03:45 +0100 Subject: [PATCH 10/22] chore(makefile): using python3 as python version instead of python3.7 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 81d1858..5160e41 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ pre-commit=./venv/bin/pre-commit .PHONY: lint venv venv: - python3.7 -m venv venv + python3 -m venv venv $(pip) install pre-commit $(pre-commit) install -t commit-msg From f347d21f39324d7abf1dfefc974dc285a84ad42e Mon Sep 17 00:00:00 2001 From: prousso Date: Fri, 29 Oct 2021 16:58:46 +0200 Subject: [PATCH 11/22] fix(bash): parsing arguments --- check_message.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/check_message.sh b/check_message.sh index 72478f5..13de8d7 100755 --- a/check_message.sh +++ b/check_message.sh @@ -2,8 +2,7 @@ set -eu -OPTIONS=$(getopt --long no-jira,allow-temp,jira-in-header,header-length:,jira-types: -- "$@") - +OPTIONS=$(getopt --longoptions no-jira,allow-temp,jira-in-header,header-length:,jira-types: --options "" -- "$@") unset COMMIT_VALIDATOR_ALLOW_TEMP COMMIT_VALIDATOR_NO_JIRA COMMIT_VALIDATOR_NO_REVERT_SHA1 GLOBAL_JIRA_IN_HEADER GLOBAL_MAX_LENGTH GLOBAL_JIRA_TYPES eval set -- $OPTIONS From d649cfabf73a762e5115923010f83c3a6b6cb808 Mon Sep 17 00:00:00 2001 From: prousso Date: Fri, 29 Oct 2021 17:06:31 +0200 Subject: [PATCH 12/22] chore(ci): add actions validator --- .github/workflows/github-actions-validator.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/workflows/github-actions-validator.yml diff --git a/.github/workflows/github-actions-validator.yml b/.github/workflows/github-actions-validator.yml new file mode 100644 index 0000000..cc6c273 --- /dev/null +++ b/.github/workflows/github-actions-validator.yml @@ -0,0 +1,13 @@ +name: "CI: github-actions-validator" + +on: + pull_request: + + +jobs: + github-actions-validator: + name: Github-actions-validator + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: lumapps/github-actions-validator@0.0.2 From 0c04f0d5c4d95882491c0c462bcf6362fdd34079 Mon Sep 17 00:00:00 2001 From: Jonathan Squirawski Date: Wed, 16 Feb 2022 11:50:02 +0100 Subject: [PATCH 13/22] chore(validator): limit commit title to 100 chars The default limit of commit titles is now set to 100 chars which allows more expressiveness in some cases. But the recommended limit is still 70 chars. --- README.md | 5 +++-- validator.bats | 18 +++++++++--------- validator.sh | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index a83e095..a0f665c 100644 --- a/README.md +++ b/README.md @@ -76,8 +76,9 @@ a **subject**: