fix(ci): use regex variables for bash 5.2+ compatibility in changelog generation

This commit is contained in:
YeonGyu-Kim 2026-02-04 15:00:31 +09:00
parent e073412da1
commit 953b1f98c9

View File

@ -255,35 +255,43 @@ jobs:
DOCS="" DOCS=""
OTHER="" OTHER=""
# Store regexes in variables for bash 5.2+ compatibility
# (bash 5.2 changed how parentheses are parsed inside [[ =~ ]])
re_skip='^(chore|ci|release|test|ignore)'
re_feat_scoped='^feat\(([^)]+)\): (.+)$'
re_fix_scoped='^fix\(([^)]+)\): (.+)$'
re_refactor_scoped='^refactor\(([^)]+)\): (.+)$'
re_docs_scoped='^docs\(([^)]+)\): (.+)$'
while IFS= read -r commit; do while IFS= read -r commit; do
[ -z "$commit" ] && continue [ -z "$commit" ] && continue
# Skip chore, ci, release, test commits # Skip chore, ci, release, test commits
[[ "$commit" =~ ^(chore|ci|release|test|ignore) ]] && continue [[ "$commit" =~ $re_skip ]] && continue
if [[ "$commit" =~ ^feat ]]; then if [[ "$commit" =~ ^feat ]]; then
# Extract scope and message: feat(scope): message -> **scope**: message # Extract scope and message: feat(scope): message -> **scope**: message
if [[ "$commit" =~ ^feat\(([^)]+)\):\ (.+)$ ]]; then if [[ "$commit" =~ $re_feat_scoped ]]; then
FEATURES="${FEATURES}\n- **${BASH_REMATCH[1]}**: ${BASH_REMATCH[2]}" FEATURES="${FEATURES}\n- **${BASH_REMATCH[1]}**: ${BASH_REMATCH[2]}"
else else
MSG="${commit#feat: }" MSG="${commit#feat: }"
FEATURES="${FEATURES}\n- ${MSG}" FEATURES="${FEATURES}\n- ${MSG}"
fi fi
elif [[ "$commit" =~ ^fix ]]; then elif [[ "$commit" =~ ^fix ]]; then
if [[ "$commit" =~ ^fix\(([^)]+)\):\ (.+)$ ]]; then if [[ "$commit" =~ $re_fix_scoped ]]; then
FIXES="${FIXES}\n- **${BASH_REMATCH[1]}**: ${BASH_REMATCH[2]}" FIXES="${FIXES}\n- **${BASH_REMATCH[1]}**: ${BASH_REMATCH[2]}"
else else
MSG="${commit#fix: }" MSG="${commit#fix: }"
FIXES="${FIXES}\n- ${MSG}" FIXES="${FIXES}\n- ${MSG}"
fi fi
elif [[ "$commit" =~ ^refactor ]]; then elif [[ "$commit" =~ ^refactor ]]; then
if [[ "$commit" =~ ^refactor\(([^)]+)\):\ (.+)$ ]]; then if [[ "$commit" =~ $re_refactor_scoped ]]; then
REFACTOR="${REFACTOR}\n- **${BASH_REMATCH[1]}**: ${BASH_REMATCH[2]}" REFACTOR="${REFACTOR}\n- **${BASH_REMATCH[1]}**: ${BASH_REMATCH[2]}"
else else
MSG="${commit#refactor: }" MSG="${commit#refactor: }"
REFACTOR="${REFACTOR}\n- ${MSG}" REFACTOR="${REFACTOR}\n- ${MSG}"
fi fi
elif [[ "$commit" =~ ^docs ]]; then elif [[ "$commit" =~ ^docs ]]; then
if [[ "$commit" =~ ^docs\(([^)]+)\):\ (.+)$ ]]; then if [[ "$commit" =~ $re_docs_scoped ]]; then
DOCS="${DOCS}\n- **${BASH_REMATCH[1]}**: ${BASH_REMATCH[2]}" DOCS="${DOCS}\n- **${BASH_REMATCH[1]}**: ${BASH_REMATCH[2]}"
else else
MSG="${commit#docs: }" MSG="${commit#docs: }"