@@ -84,10 +84,16 @@ jobs:
8484 run : |
8585 email="ci-${GITHUB_RUN_ID}-${RANDOM}+clerk_test@clerkcookie.com"
8686 password="ClerkCI!$(openssl rand -hex 8)Aa1"
87- response =$(curl -fsS -X POST https://api.clerkstage.dev/v1/users \
87+ http_code =$(curl -sS -o /tmp/bapi_response.json -w "%{http_code}" -X POST https://api.clerkstage.dev/v1/users \
8888 -H "Authorization: Bearer $CLERK_SECRET_KEY" \
8989 -H "Content-Type: application/json" \
9090 -d "{\"email_address\":[\"$email\"],\"password\":\"$password\"}")
91+ if [ "$http_code" -lt 200 ] || [ "$http_code" -ge 300 ]; then
92+ echo "::error::BAPI user creation failed (HTTP $http_code)"
93+ jq . /tmp/bapi_response.json 2>/dev/null || cat /tmp/bapi_response.json
94+ exit 1
95+ fi
96+ response=$(cat /tmp/bapi_response.json)
9197 user_id=$(echo "$response" | jq -er '.id')
9298 echo "::add-mask::$password"
9399 echo "email=$email" >> "$GITHUB_OUTPUT"
@@ -189,10 +195,16 @@ jobs:
189195 run : |
190196 email="ci-${GITHUB_RUN_ID}-${RANDOM}+clerk_test@clerkcookie.com"
191197 password="ClerkCI!$(openssl rand -hex 8)Aa1"
192- response =$(curl -fsS -X POST https://api.clerkstage.dev/v1/users \
198+ http_code =$(curl -sS -o /tmp/bapi_response.json -w "%{http_code}" -X POST https://api.clerkstage.dev/v1/users \
193199 -H "Authorization: Bearer $CLERK_SECRET_KEY" \
194200 -H "Content-Type: application/json" \
195201 -d "{\"email_address\":[\"$email\"],\"password\":\"$password\"}")
202+ if [ "$http_code" -lt 200 ] || [ "$http_code" -ge 300 ]; then
203+ echo "::error::BAPI user creation failed (HTTP $http_code)"
204+ jq . /tmp/bapi_response.json 2>/dev/null || cat /tmp/bapi_response.json
205+ exit 1
206+ fi
207+ response=$(cat /tmp/bapi_response.json)
196208 user_id=$(echo "$response" | jq -er '.id')
197209 echo "::add-mask::$password"
198210 echo "email=$email" >> "$GITHUB_OUTPUT"
0 commit comments