Skip to content

Commit 03efea1

Browse files
fix(ci): store regex in variable to fix bash parsing error (#564)
The regex pattern for parsing conventional commits contained special characters (parentheses, brackets) that bash was misinterpreting, causing "syntax error in conditional expression: unexpected token ')'" Fix by storing the pattern in a variable first, which prevents bash from parsing the special characters during script expansion. Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 783e071 commit 03efea1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,14 @@ jobs:
177177
OTHER=""
178178
CONTRIBUTORS=""
179179
180+
# Store regex in variable to avoid bash parsing issues with special characters
181+
COMMIT_PATTERN='^([a-z]+)(\(([^)]+)\))?!?:[[:space:]](.+)$'
182+
180183
while IFS='|' read -r hash subject author; do
181184
[ -z "$hash" ] && continue
182185
183186
# Extract commit type and scope
184-
if [[ $subject =~ ^([a-z]+)(\(([^)]+)\))?!?:\ (.+)$ ]]; then
187+
if [[ $subject =~ $COMMIT_PATTERN ]]; then
185188
type="${BASH_REMATCH[1]}"
186189
scope="${BASH_REMATCH[3]}"
187190
description="${BASH_REMATCH[4]}"

0 commit comments

Comments
 (0)