@@ -19,13 +19,50 @@ jobs:
1919 steps :
2020 - name : Parse testing SDK branch from PR body
2121 id : parse
22+ shell : bash
2223 run : |
23- # Look for a line like: TESTING_SDK_BRANCH: feature/foo
24- REF=$(printf '%s\n' '${{ github.event.pull_request.body }}' | sed -n 's/^TESTING_SDK_BRANCH:[[:space:]]*//p' | head -n1)
25- if [ -z "$REF" ]; then REF="main"; fi
26- echo "testing_ref=$REF" >> "$GITHUB_OUTPUT"
27- echo "Using testing SDK branch: $REF"
28-
24+ set -euo pipefail
25+
26+ # Safely capture the PR body into a variable without breaking on newlines/quoting
27+ pr_body=$(cat <<'EOF'
28+ ${{ github.event.pull_request.body }}
29+ EOF
30+ )
31+
32+ # Default if not found
33+ default_ref="main"
34+
35+ # Extract a line that looks like:
36+ # TESTING_SDK_BRANCH: feature/foo
37+ # Testing_Sdk_Branch: feature/foo
38+ # some text TESTING_SDK_BRANCH: foo
39+ #
40+ # 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" \
45+ | awk '
46+ BEGIN { IGNORECASE = 1 }
47+ {
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
53+ }
54+ }
55+ ' \
56+ | head -n1 \
57+ | tr -d ' \r' \
58+ )
59+
60+ if [ -z "${ref:-}" ]; then
61+ ref="$default_ref"
62+ fi
63+
64+ echo "testing_ref=$ref" >> "$GITHUB_OUTPUT"
65+ echo "Using testing SDK branch : $ref"
2966 - name : Checkout Language SDK (this PR)
3067 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3168 with :
0 commit comments