From c5d498299f8524f016f4e8c33c9ac0e90b644cb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20=C5=A0imko?= Date: Thu, 25 Jan 2024 12:05:18 +0100 Subject: [PATCH 1/2] ci(shellcheck): fix exit code propagation (#562) Return properly the exit code status of shellcheck command when looping through shell script files. --- run-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run-tests.sh b/run-tests.sh index 2a16822f..2f9daaae 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -68,7 +68,7 @@ check_commitlint () { } check_shellcheck () { - find . -name "*.sh" -exec shellcheck {} \; + find . -name "*.sh" -exec shellcheck {} \+ } check_pydocstyle () { From 4b8f53909d281dcd2445833544c4107c8ebd1d81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20=C5=A0imko?= Date: Thu, 25 Jan 2024 12:05:18 +0100 Subject: [PATCH 2/2] ci(commitlint): check for the presence of concrete PR number (#562) Enrich commitlint checker in order to check the precise PR number in the commit log headline. --- .github/workflows/ci.yml | 2 +- run-tests.sh | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12d8d6fc..cea15a21 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: - name: Check commit message compliance of the pull request if: github.event_name == 'pull_request' run: | - ./run-tests.sh --check-commitlint ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} ${{ github.event.pull_request.head.sha }} + ./run-tests.sh --check-commitlint ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} ${{ github.event.pull_request.head.sha }} ${{ github.event.pull_request.number }} lint-shellcheck: runs-on: ubuntu-20.04 diff --git a/run-tests.sh b/run-tests.sh index 2f9daaae..99dc9f8b 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -52,13 +52,14 @@ stop_db_container () { check_commitlint () { from=${2:-master} to=${3:-HEAD} + pr=${4:-[0-9]+} npx commitlint --from="$from" --to="$to" found=0 while IFS= read -r line; do - if echo "$line" | grep -qP "\(\#[0-9]+\)$"; then + if echo "$line" | grep -qP "\(\#$pr\)$"; then true else - echo "✖ PR number missing in $line" + echo "✖ Headline does not end by '(#$pr)' PR number: $line" found=1 fi done < <(git log "$from..$to" --format="%s")