Skip to content

Commit a37bfb7

Browse files
committed
Apply suggestion from @Copilot
1 parent 79f6fc8 commit a37bfb7

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

.github/workflows/on-push-verification-in-tree.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,19 @@ jobs:
4141
run: |
4242
BRANCH="${{ github.base_ref }}" # on: pull_request, otherwise null
4343
BRANCH=${BRANCH:-${{ github.ref_name }}} # on: push
44-
LLVM_VERSION_LONG=$(echo $BRANCH | grep -oP 'ocl-open-\K\d+') # Eg. 200 for LLVM 20
45-
if [ -z "$LLVM_VERSION_LONG" ]; then
44+
# Extract the padded LLVM version (e.g., 200 for LLVM 20)
45+
LLVM_VERSION_PADDED=$(echo "$BRANCH" | sed -n 's/^ocl-open-\([0-9]\+\)$/\1/p')
46+
if [ -z "$LLVM_VERSION_PADDED" ]; then
4647
echo "[OPENCL-CLANG] Error: Could not parse LLVM version from branch name '$BRANCH'"
4748
exit 1
4849
fi
49-
LLVM_VERSION_SHORT=${LLVM_VERSION_LONG::-1} # Eg. 20 for LLVM 20
50+
# Extract the actual LLVM version (e.g., 20 from 200)
51+
if [[ "$LLVM_VERSION_PADDED" =~ ^([0-9]+)0$ ]]; then
52+
LLVM_VERSION_SHORT="${BASH_REMATCH[1]}"
53+
else
54+
echo "[OPENCL-CLANG] Error: Unexpected LLVM version format '$LLVM_VERSION_PADDED' from branch name '$BRANCH'"
55+
exit 1
56+
fi
5057
echo "llvm_version=$LLVM_VERSION_SHORT" >> $GITHUB_OUTPUT
5158
5259
- name: Run build-opencl-clang action

0 commit comments

Comments
 (0)