@@ -49,31 +49,50 @@ jobs:
49
49
local data="$3"
50
50
local description="$4"
51
51
52
- echo "Calling API: $description"
52
+ echo "=== DEBUG: API Call Details ==="
53
+ echo "Description: $description"
54
+ echo "URL: $url"
55
+ echo "Method: $method"
56
+ echo "Data: $data"
53
57
54
- # Store response in a temporary file
55
58
temp_file=$(mktemp)
56
-
57
- # Execute curl with minimal output
58
- response=$(curl -s \
59
+ http_code=$(curl -v -s -w "%{http_code}" \
59
60
--request "$method" "$url" \
60
61
--header "Authorization: Bearer ${{ steps.bytebase-login.outputs.token }}" \
61
62
--header "Content-Type: application/json" \
62
63
--data "$data" \
63
- --write-out "\n%{http_code}" \
64
- 2>/dev/null)
65
-
66
- http_code=$(echo "$response" | tail -n1)
67
- body=$(echo "$response" | sed '$d')
64
+ -o "$temp_file" 2>&1)
68
65
69
- echo "Status code: $http_code"
66
+ echo "=== DEBUG: Response Details ==="
67
+ echo "HTTP Status: $http_code"
68
+ echo "Response body:"
69
+ cat "$temp_file"
70
+ echo "==========================="
70
71
71
72
if [[ $http_code -lt 200 || $http_code -ge 300 ]]; then
72
- echo "Error: Failed $description"
73
- echo "Response: $body"
73
+ 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"
90
+ rm "$temp_file"
74
91
return 1
75
92
fi
76
93
94
+ cat "$temp_file"
95
+ rm "$temp_file"
77
96
return 0
78
97
}
79
98
@@ -117,12 +136,12 @@ jobs:
117
136
118
137
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
119
138
echo "Processing $file"
120
- SQL_CONTENT=$(cat "$file" | python3 -c "import sys,base64,json; content=sys.stdin.read(); encoded=base64.b64encode(content.encode()).decode(); print(json.dumps(encoded)[1:-1]) ")
139
+ SQL_CONTENT=$(base64 < "$file")
121
140
echo "SQL_CONTENT=$SQL_CONTENT" >> $GITHUB_ENV
122
141
STEP_ID=$(python3 -c "import uuid; print(str(uuid.uuid4()))")
123
142
echo "STEP_ID=$STEP_ID" >> $GITHUB_ENV
124
143
BASE_URL="${{ steps.bytebase-login.outputs.api_url }}"
125
- echo "BASE_URL111 =$BASE_URL"
144
+ echo "BASE_URL1111 =$BASE_URL"
126
145
echo "BASE_URL=$BASE_URL" >> $GITHUB_ENV
127
146
128
147
sheet_data=$(call_api \
0 commit comments