From 2135ca609b225df9eb4e8a0d3f3f806daf75ea23 Mon Sep 17 00:00:00 2001 From: Stanislav Stefinyn <100129023+StanLumapps@users.noreply.github.com> Date: Fri, 5 Jun 2026 12:03:07 +0200 Subject: [PATCH] chore(check-message): fix issue for mac with bash < 4.0 The ${var,,} syntax requires bash 4+, but macOS typically ships with bash 3.x replace with the portable tr command that works across all bash versions --- check_message.bats | 12 ++++++++++++ check_message.sh | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/check_message.bats b/check_message.bats index cbf165d..df892cf 100644 --- a/check_message.bats +++ b/check_message.bats @@ -27,6 +27,18 @@ teardown() { [ "$status" -eq 0 ] } +@test "check_message: skips message starting with 'MERGE' (all caps)" { + echo "MERGE branch 'feature' into 'main'" > "$TMPFILE" + run bash "$SCRIPT" "$TMPFILE" + [ "$status" -eq 0 ] +} + +@test "check_message: skips message starting with 'MeRgE' (mixed case)" { + echo "MeRgE branch 'test'" > "$TMPFILE" + run bash "$SCRIPT" "$TMPFILE" + [ "$status" -eq 0 ] +} + @test "check_message: strips comment lines before validating" { printf "# This is a comment\nfeat(scope): valid subject\n" > "$TMPFILE" run bash "$SCRIPT" --no-jira "$TMPFILE" diff --git a/check_message.sh b/check_message.sh index f635a69..a7a5887 100755 --- a/check_message.sh +++ b/check_message.sh @@ -35,8 +35,8 @@ fi # removing comment lines from message MESSAGE=$(sed '/^#/d' "$1") -FIRST_WORD=${MESSAGE%% *} -if [[ "${FIRST_WORD,,}" == merge ]] +FIRST_WORD=$(echo "${MESSAGE%% *}" | tr '[:upper:]' '[:lower:]') +if [[ "${FIRST_WORD}" == merge ]] then # ignore merge commits (merge after conflict resolution) exit