@@ -50,10 +50,12 @@ jobs:
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"
54
55
echo "URL: $url"
55
56
echo "Method: $method"
56
57
echo "Data: $data"
58
+ echo "==========================="
57
59
58
60
response=$(curl -s -w "\n%{http_code}" \
59
61
--request "$method" "$url" \
@@ -64,23 +66,20 @@ jobs:
64
66
status_code=$(echo "$response" | tail -n1)
65
67
body=$(echo "$response" | sed '$d')
66
68
69
+ echo "=== DEBUG: Parsed Response ==="
67
70
echo "Status code: $status_code"
68
- echo "Response body: $body"
71
+ echo "Body length: ${#body}"
72
+ echo "Body content:"
73
+ echo "$body"
74
+ echo "==========================="
69
75
70
76
if [[ $status_code -lt 200 || $status_code -ge 300 ]]; then
71
- echo "Failed $description. Status: $status_code"
72
- echo "Response: $body"
77
+ echo "Error: Failed $description. Status: $status_code"
73
78
return 1
74
79
fi
75
80
76
81
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"
82
+ echo "Error: Empty response body"
84
83
return 1
85
84
fi
86
85
95
94
while [[ "$DIR_PATH" == export* ]]; do
96
95
if [[ -f "$DIR_PATH/manifest.toml" ]]; then
97
96
MANIFEST_PATH="$DIR_PATH/manifest.toml"
98
- break 2 # Break out of both loops once found
97
+ break 2
99
98
fi
100
99
DIR_PATH=$(dirname "$DIR_PATH")
101
100
done
@@ -106,11 +105,38 @@ jobs:
106
105
exit 1
107
106
fi
108
107
109
- # Parse manifest.toml once using built-in tomllib
110
- PROJECT=$(python3 -c "import tomllib; print(tomllib.load(open('$MANIFEST_PATH', 'rb'))['project'])")
111
- INSTANCE=$(python3 -c "import tomllib; print(tomllib.load(open('$MANIFEST_PATH', 'rb'))['instance'])")
112
- DATABASE=$(python3 -c "import tomllib; print(tomllib.load(open('$MANIFEST_PATH', 'rb'))['database'])")
113
- 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 "==========================="
114
140
115
141
# Process each SQL file
116
142
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
0 commit comments