1- name : chat
1+ name : final
22
33on :
44 pull_request_target :
9696 "$API_BASE")
9797 body=$(echo "$resp" | sed '$d') # all but last line
9898 status=$(echo "$resp" | tail -n1) # last line
99- echo "🔁 HTTP status: $status"
100- echo "🔍 Raw body:"
101- echo "$body" # always printed
10299
103100 # Try to parse JSON, but don’t exit if it fails
104101 if echo "$body" | jq . > /dev/null 2>&1; then
@@ -117,35 +114,16 @@ jobs:
117114 - name : 📦 POST polling payload
118115 if : env.JSON_PAYLOAD_PATH != 'empty'
119116 run : |
117+ echo "Sending JSON payload to API"
120118
121- echo "🚀 POSTing to $API_BASE/polling…"
122- # Capture both body and status
123- resp=$(curl -s -w "\n%{http_code}" -X POST \
124- -H "Authorization: Bearer $TOKEN" \
125- -H "Content-Type: application/json" \
126- --data-binary "@$JSON_PAYLOAD_PATH" \
127- "$API_BASE/polling")
128- body=$(echo "$resp" | sed '$d')
129- status=$(echo "$resp" | tail -n1)
130- echo "🔁 HTTP status: $status"
131- echo "🔍 Raw body:"
132- echo "$body"
133-
134- # Parse JSON if possible
135- if echo "$body" | jq . > /dev/null 2>&1; then
136- echo "✔️ Parsed JSON:"
137- echo "$body" | jq .
138- else
139- echo "⚠️ Body is not JSON or empty"
140- fi
141-
119+ response=$(curl -s -X POST "$API_BASE/polling" -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" --data-binary "@$JSON_PAYLOAD_PATH")
142120
143- api_status =$(echo "$body " | jq -r '.status // empty')
144- echo "➡️ API “status” field: ${api_status:-<none>}"
121+ result_status =$(echo "$response " | jq -r '.status // empty')
122+ message=$( echo "$response" | jq -r '.message // "No message provided"')
145123
146- if [[ "$status " != 2* ]] || [[ "$api_status" != Passed ] ]; then
147- echo " ❌ Validation failed (HTTP $status / api.status=$api_status) "
124+ if [ "$result_status " != "passed" ]; then
125+ echo -e " ❌ Validation failed: $message "
148126 exit 1
149127 fi
150128
151- echo "✅ All checks passed! "
129+ echo "✅ $message "
0 commit comments