Skip to content

Commit e778da3

Browse files
Fix CI filter regex to use sed instead of BASH_REMATCH [system:MiyabiG,MiyabiC] [code:LQCD_dw_solver]
1 parent bd58b5f commit e778da3

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

.gitlab-ci.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,29 @@ variables:
3131
# Priority 1: API trigger variables (from curl -F "variables[system]=...")
3232
if [[ -n "$system" ]]; then
3333
echo "System filter from API variable: $system"
34-
elif [[ "$CI_COMMIT_MESSAGE" =~ \[system:([^\]]+)\] ]]; then
35-
export system="${BASH_REMATCH[1]}"
36-
echo "System filter from commit message: $system"
3734
else
38-
echo "No system filter detected, running all systems"
35+
# Extract from commit message using sed
36+
system_match=$(echo "$CI_COMMIT_MESSAGE" | sed -n 's/.*\[system:\([^]]*\)\].*/\1/p')
37+
if [[ -n "$system_match" ]]; then
38+
export system="$system_match"
39+
echo "System filter from commit message: $system"
40+
else
41+
echo "No system filter detected, running all systems"
42+
fi
3943
fi
4044
- |
4145
# Priority 1: API trigger variables (from curl -F "variables[code]=...")
4246
if [[ -n "$code" ]]; then
4347
echo "Code filter from API variable: $code"
44-
elif [[ "$CI_COMMIT_MESSAGE" =~ \[code:([^\]]+)\] ]]; then
45-
export code="${BASH_REMATCH[1]}"
46-
echo "Code filter from commit message: $code"
4748
else
48-
echo "No code filter detected, running all programs"
49+
# Extract from commit message using sed
50+
code_match=$(echo "$CI_COMMIT_MESSAGE" | sed -n 's/.*\[code:\([^]]*\)\].*/\1/p')
51+
if [[ -n "$code_match" ]]; then
52+
export code="$code_match"
53+
echo "Code filter from commit message: $code"
54+
else
55+
echo "No code filter detected, running all programs"
56+
fi
4957
fi
5058
5159
generate_matrix:

0 commit comments

Comments
 (0)