Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .github/workflows/on-push-verification-in-tree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,19 @@ jobs:
- name: Checkout opencl-clang sources for action files
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

# This step will fail when the branch naming scheme 'ocl-open-XXX' changes!
- name: Parse LLVM version from branch name
id: check-llvm-version
run: |
BRANCH="${{ github.base_ref }}" # on: pull_request, otherwise null
BRANCH=${BRANCH:-${{ github.ref_name }}} # on: push
LLVM_VERSION_LONG=$(echo $BRANCH | grep -oP '\d+') # Eg. 190 for LLVM 19
Copy link

Copilot AI Nov 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no error handling if the branch name doesn't match the expected 'ocl-open-XXX' pattern. The grep command will silently fail and LLVM_VERSION_LONG will be empty, causing subsequent commands to produce incorrect results. Add validation to check if the pattern was found and fail with a clear error message if not, e.g., if [ -z \"$LLVM_VERSION_LONG\" ]; then echo \"Error: Could not parse LLVM version from branch name $BRANCH\"; exit 1; fi.

Suggested change
LLVM_VERSION_LONG=$(echo $BRANCH | grep -oP '\d+') # Eg. 190 for LLVM 19
LLVM_VERSION_LONG=$(echo $BRANCH | grep -oP '\d+') # Eg. 190 for LLVM 19
if [ -z "$LLVM_VERSION_LONG" ]; then
echo "Error: Could not parse LLVM version from branch name '$BRANCH'"
exit 1
fi

Copilot uses AI. Check for mistakes.
LLVM_VERSION_SHORT=${LLVM_VERSION_LONG::-1} # Eg. 19 for LLVM 19
echo "llvm_version=$LLVM_VERSION_SHORT" >> $GITHUB_OUTPUT

- name: Run build-opencl-clang action
uses: ./.github/actions/build-opencl-clang
with:
ref_llvm: main
ref_translator: main
ref_llvm: release/${{ steps.check-llvm-version.outputs.llvm_version }}.x
ref_translator: llvm_release_${{ steps.check-llvm-version.outputs.llvm_version }}0
ref_opencl-clang: ${{ github.ref }}
Loading