Skip to content

Commit 6def8d0

Browse files
authored
Update ci.yml
1 parent 1d3193d commit 6def8d0

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

.github/workflows/ci.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,23 @@ jobs:
4444
4545
echo "🌐 Fetching server JAR URL for version $MC_VERSION and type $SERVER_TYPE..."
4646
API_RESPONSE=$(curl -s "https://mcutils.com/api/v1/jars?version=$MC_VERSION&type=$SERVER_TYPE")
47-
47+
4848
# Debug: Print the raw API response
4949
echo "API Response: $API_RESPONSE"
5050
5151
# Validate JSON using jq
52-
if echo "$API_RESPONSE" | jq empty; then
52+
if echo "$API_RESPONSE" | jq empty 2>/dev/null; then
5353
SERVER_JAR_URL=$(echo "$API_RESPONSE" | jq -r '.url')
54+
55+
# Check if 'url' field exists and is not empty
56+
if [ -z "$SERVER_JAR_URL" ] || [ "$SERVER_JAR_URL" == "null" ]; then
57+
echo "❌ Error: 'url' field is missing or empty in the API response."
58+
echo "Debug Info: $API_RESPONSE"
59+
exit 1
60+
fi
5461
else
5562
echo "❌ Error: Invalid JSON response from API."
56-
exit 1
57-
fi
58-
59-
if [ "$SERVER_JAR_URL" == "null" ] || [ -z "$SERVER_JAR_URL" ]; then
60-
echo "❌ Error: Could not find a server JAR for version $MC_VERSION and type $SERVER_TYPE."
63+
echo "Debug Info: $API_RESPONSE"
6164
exit 1
6265
fi
6366

0 commit comments

Comments
 (0)