|
64 | 64 | cat "$temp_file"
|
65 | 65 | echo "------------------------"
|
66 | 66 |
|
67 | | - if [[ $http_code -lt 200 || $http_code -ge 300 ]]; then |
68 | | - rm "$temp_file" |
69 | | - return 1 |
70 | | - fi |
71 | | - |
| 67 | + # Return the response regardless of status code |
| 68 | + # This allows the caller to handle the response |
72 | 69 | cat "$temp_file"
|
73 | | - rm "$temp_file" |
74 | | - return 0 |
75 | 70 | }
|
76 | 71 |
|
77 | 72 | MANIFEST_PATH=""
|
@@ -120,14 +115,23 @@ jobs:
|
120 | 115 | BASE_URL="${{ steps.bytebase-login.outputs.api_url }}"
|
121 | 116 |
|
122 | 117 | echo "DEBUG: About to make first API call to create sheet"
|
123 | | - sheet_data=$(call_api \ |
| 118 | + response=$(call_api \ |
124 | 119 | "$BASE_URL/projects/$PROJECT/sheets" \
|
125 | 120 | "POST" \
|
126 | 121 | "{\"title\":\"\",\"content\":\"$SQL_CONTENT\",\"type\":\"TYPE_SQL\",\"source\":\"SOURCE_BYTEBASE_ARTIFACT\",\"visibility\":\"VISIBILITY_PUBLIC\"}" \
|
127 | 122 | "Create Sheet")
|
128 | 123 |
|
129 | | - echo "DEBUG: After first API call" |
130 | | - SHEET_NAME=$(echo "$sheet_data" | python3 -c "import sys, json; print(json.load(sys.stdin)['name'])") |
| 124 | + echo "DEBUG: Raw API Response:" |
| 125 | + echo "$response" |
| 126 | + |
| 127 | + # Only try to parse as JSON if we have a response |
| 128 | + if [ -n "$response" ]; then |
| 129 | + SHEET_NAME=$(echo "$response" | python3 -c "import sys, json; print(json.load(sys.stdin).get('name', ''))" || echo "") |
| 130 | + echo "DEBUG: Sheet name: $SHEET_NAME" |
| 131 | + else |
| 132 | + echo "ERROR: Empty response from API" |
| 133 | + exit 1 |
| 134 | + fi |
131 | 135 |
|
132 | 136 | echo "finishing sheetname ================================================"
|
133 | 137 |
|
|
0 commit comments