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