Skip to content

Commit dcb14d0

Browse files
Merge pull request #38 from bytebase/a-branch-7
fix
2 parents bb13909 + def1028 commit dcb14d0

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

.github/workflows/bb-export.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,15 @@ jobs:
5353
echo "Description: $description"
5454
echo "URL: $url"
5555
echo "Method: $method"
56+
echo "Data: $data"
5657
5758
temp_file=$(mktemp)
58-
http_code=$(curl -s -w "%{http_code}" \
59+
http_code=$(curl -v -s -w "%{http_code}" \
5960
--request "$method" "$url" \
6061
--header "Authorization: Bearer ${{ steps.bytebase-login.outputs.token }}" \
6162
--header "Content-Type: application/json" \
6263
--data "$data" \
63-
-o "$temp_file")
64+
-o "$temp_file" 2>&1)
6465
6566
echo "=== DEBUG: Response Details ==="
6667
echo "HTTP Status: $http_code"
@@ -70,6 +71,22 @@ jobs:
7071
7172
if [[ $http_code -lt 200 || $http_code -ge 300 ]]; then
7273
echo "Error: Failed $description. Status: $http_code"
74+
cat "$temp_file"
75+
rm "$temp_file"
76+
return 1
77+
fi
78+
79+
if [[ ! -s "$temp_file" ]]; then
80+
echo "Error: Empty response from server"
81+
rm "$temp_file"
82+
return 1
83+
fi
84+
85+
# Simple one-line JSON validation
86+
if ! python3 -c "import json,sys; json.load(open('$temp_file'))" 2>/dev/null; then
87+
echo "Error: Invalid JSON response"
88+
echo "Response content:"
89+
cat "$temp_file"
7390
rm "$temp_file"
7491
return 1
7592
fi

0 commit comments

Comments
 (0)