@@ -22,45 +22,50 @@ jobs:
2222 shell : bash
2323 run : |
2424 set -euo pipefail
25-
26- # Safely capture the PR body into a variable without breaking on newlines/quoting
25+
26+ # Safely capture the PR body without breaking on quotes/newlines.
27+ # GitHub interpolates the expression *before* bash sees it.
2728 pr_body=$(cat <<'EOF'
2829 ${{ github.event.pull_request.body }}
2930 EOF
3031 )
31-
32- # Default if not found
32+
3333 default_ref="main"
34-
35- # Extract a line that looks like:
34+
35+ # Extract value from lines like:
3636 # TESTING_SDK_BRANCH: feature/foo
37- # Testing_Sdk_Branch: feature/foo
38- # some text TESTING_SDK_BRANCH: foo
37+ # TESTING_SDK_BRANCH = feature/foo
38+ # some text TESTING_SDK_BRANCH : feature/ foo
3939 #
4040 # Rules:
41- # - key is case‑insensitive
42- # - allows leading/trailing whitespace
43- # - everything after the first ":" (minus surrounding spaces) is the value
44- ref=$(printf '%s\n' "$pr_body" \
41+ # - case-insensitive key
42+ # - accept ":" or "="
43+ # - ignore surrounding whitespace
44+ ref=$(
45+ printf '%s\n' "$pr_body" \
4546 | awk '
4647 BEGIN { IGNORECASE = 1 }
4748 {
48- # Look for TESTING_SDK_BRANCH: anywhere on the line
49- match($0, /TESTING_SDK_BRANCH[[:space:]]*:[[:space:]]*(.*)$/, m)
50- if (m[1] != "") {
51- print m[1]
52- exit 0
49+ # Match key, optional whitespace, : or =, optional whitespace, capture rest
50+ if (match($0, /TESTING_SDK_BRANCH[[:space:]]*[:=][[:space:]]*(.*)$/, m)) {
51+ val = m[1]
52+ # Trim trailing whitespace
53+ sub(/[[:space:]]+$/, "", val)
54+ if (val != "") {
55+ print val
56+ exit 0
57+ }
5358 }
5459 }
5560 ' \
5661 | head -n1 \
57- | tr -d ' \r' \
62+ | tr -d "\r"
5863 )
59-
64+
6065 if [ -z "${ref:-}" ]; then
6166 ref="$default_ref"
6267 fi
63-
68+
6469 echo "testing_ref=$ref" >> "$GITHUB_OUTPUT"
6570 echo "Using testing SDK branch: $ref"
6671 - name: Checkout Language SDK (this PR)
0 commit comments