50
50
local data="$3"
51
51
local description="$4"
52
52
53
- echo "Making $description API call..."
53
+ echo "=== DEBUG: API Call Details ==="
54
+ echo "Description: $description"
55
+ echo "URL: $url"
56
+ echo "Method: $method"
57
+ echo "Data: $data"
58
+ echo "==========================="
59
+
54
60
response=$(curl -s -w "\n%{http_code}" \
55
61
--request "$method" "$url" \
56
62
--header "Authorization: Bearer ${{ steps.bytebase-login.outputs.token }}" \
@@ -60,10 +66,20 @@ jobs:
60
66
status_code=$(echo "$response" | tail -n1)
61
67
body=$(echo "$response" | sed '$d')
62
68
69
+ echo "=== DEBUG: Parsed Response ==="
63
70
echo "Status code: $status_code"
71
+ echo "Body length: ${#body}"
72
+ echo "Body content:"
73
+ echo "$body"
74
+ echo "==========================="
75
+
64
76
if [[ $status_code -lt 200 || $status_code -ge 300 ]]; then
65
- echo "Failed $description. Status: $status_code"
66
- echo "Response: $body"
77
+ echo "Error: Failed $description. Status: $status_code"
78
+ return 1
79
+ fi
80
+
81
+ if [[ -z "$body" ]]; then
82
+ echo "Error: Empty response body"
67
83
return 1
68
84
fi
69
85
78
94
while [[ "$DIR_PATH" == export* ]]; do
79
95
if [[ -f "$DIR_PATH/manifest.toml" ]]; then
80
96
MANIFEST_PATH="$DIR_PATH/manifest.toml"
81
- break 2 # Break out of both loops once found
97
+ break 2
82
98
fi
83
99
DIR_PATH=$(dirname "$DIR_PATH")
84
100
done
@@ -89,11 +105,38 @@ jobs:
89
105
exit 1
90
106
fi
91
107
92
- # Parse manifest.toml once using built-in tomllib
93
- PROJECT=$(python3 -c "import tomllib; print(tomllib.load(open('$MANIFEST_PATH', 'rb'))['project'])")
94
- INSTANCE=$(python3 -c "import tomllib; print(tomllib.load(open('$MANIFEST_PATH', 'rb'))['instance'])")
95
- DATABASE=$(python3 -c "import tomllib; print(tomllib.load(open('$MANIFEST_PATH', 'rb'))['database'])")
96
- FORMAT=$(python3 -c "import tomllib; config=tomllib.load(open('$MANIFEST_PATH', 'rb')); print(config.get('format', 'JSON'))")
108
+ echo "Found manifest file at: $MANIFEST_PATH"
109
+ echo "Manifest contents:"
110
+ cat "$MANIFEST_PATH"
111
+
112
+ # Parse manifest.toml with error handling
113
+ read_toml() {
114
+ local key="$1"
115
+ python3 -c "
116
+ import sys
117
+ import tomllib
118
+ try :
119
+ with open('$MANIFEST_PATH', 'rb') as f :
120
+ data = tomllib.load(f)
121
+ print(data.get('$key', ''))
122
+ except Exception as e :
123
+ print(f'Error reading $key : {str(e)}', file=sys.stderr)
124
+ sys.exit(1)
125
+ "
126
+ }
127
+
128
+ # Read each value with error handling
129
+ PROJECT=$(read_toml " project") || exit 1
130
+ INSTANCE=$(read_toml "instance") || exit 1
131
+ DATABASE=$(read_toml "database") || exit 1
132
+ FORMAT=$(read_toml "format") || FORMAT="JSON"
133
+
134
+ echo "=== Parsed Configuration ==="
135
+ echo "Project : $PROJECT"
136
+ echo "Instance : $INSTANCE"
137
+ echo "Database : $DATABASE"
138
+ echo "Format : $FORMAT"
139
+ echo "==========================="
97
140
98
141
# Process each SQL file
99
142
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
0 commit comments