@@ -50,10 +50,12 @@ jobs:
5050 local data="$3"
5151 local description="$4"
5252
53- echo "Making $description API call..."
53+ echo "=== DEBUG: API Call Details ==="
54+ echo "Description: $description"
5455 echo "URL: $url"
5556 echo "Method: $method"
5657 echo "Data: $data"
58+ echo "==========================="
5759
5860 response=$(curl -s -w "\n%{http_code}" \
5961 --request "$method" "$url" \
@@ -64,23 +66,20 @@ jobs:
6466 status_code=$(echo "$response" | tail -n1)
6567 body=$(echo "$response" | sed '$d')
6668
69+ echo "=== DEBUG: Parsed Response ==="
6770 echo "Status code: $status_code"
68- echo "Response body: $body"
71+ echo "Body length: ${#body}"
72+ echo "Body content:"
73+ echo "$body"
74+ echo "==========================="
6975
7076 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"
7378 return 1
7479 fi
7580
7681 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"
8483 return 1
8584 fi
8685
9594 while [[ "$DIR_PATH" == export* ]]; do
9695 if [[ -f "$DIR_PATH/manifest.toml" ]]; then
9796 MANIFEST_PATH="$DIR_PATH/manifest.toml"
98- break 2 # Break out of both loops once found
97+ break 2
9998 fi
10099 DIR_PATH=$(dirname "$DIR_PATH")
101100 done
@@ -106,11 +105,38 @@ jobs:
106105 exit 1
107106 fi
108107
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 "==========================="
114140
115141 # Process each SQL file
116142 for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
0 commit comments