File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 5151 local description="$4"
5252
5353 echo "Making $description API call..."
54+ echo "URL: $url"
55+ echo "Method: $method"
56+ echo "Data: $data"
57+
5458 response=$(curl -s -w "\n%{http_code}" \
5559 --request "$method" "$url" \
5660 --header "Authorization: Bearer ${{ steps.bytebase-login.outputs.token }}" \
@@ -61,12 +65,25 @@ jobs:
6165 body=$(echo "$response" | sed '$d')
6266
6367 echo "Status code: $status_code"
68+ echo "Response body: $body"
69+
6470 if [[ $status_code -lt 200 || $status_code -ge 300 ]]; then
6571 echo "Failed $description. Status: $status_code"
6672 echo "Response: $body"
6773 return 1
6874 fi
6975
76+ if [[ -z "$body" ]]; then
77+ echo "Empty response body"
78+ return 1
79+ fi
80+
81+ # Validate JSON response
82+ if ! echo "$body" | python3 -c "import sys, json; json.load(sys.stdin)" > /dev/null 2>&1; then
83+ echo "Invalid JSON response"
84+ return 1
85+ fi
86+
7087 echo "$body"
7188 return 0
7289 }
You can’t perform that action at this time.
0 commit comments