Skip to content

Commit 9bca063

Browse files
authored
Merge pull request #142 from step-security/fix/subscription
fix: updated subscription check code
2 parents b5ec2ce + 02c39f4 commit 9bca063

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

start-mongodb.sh

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,18 @@ API_URL="https://agent.api.stepsecurity.io/v1/github/$GITHUB_REPOSITORY/actions/
1515

1616
# Set a timeout for the curl command (3 seconds)
1717
RESPONSE=$(curl --max-time 3 -s -w "%{http_code}" "$API_URL" -o /dev/null) || true
18-
CURL_EXIT_CODE=${?}
19-
20-
# Check if the response code is not 200
21-
if [ $CURL_EXIT_CODE -ne 0 ] || [ "$RESPONSE" != "200" ]; then
22-
if [ -z "$RESPONSE" ] || [ "$RESPONSE" == "000" ] || [ $CURL_EXIT_CODE -ne 0 ]; then
23-
echo "Timeout or API not reachable. Continuing to next step."
24-
else
25-
echo "Subscription is not valid. Reach out to support@stepsecurity.io"
26-
exit 1
27-
fi
18+
CURL_EXIT_CODE=$?
19+
20+
# Decide based on curl exit code and HTTP status
21+
if [ $CURL_EXIT_CODE -ne 0 ]; then
22+
echo "Timeout or API not reachable. Continuing to next step."
23+
elif [ "$RESPONSE" = "200" ]; then
24+
:
25+
elif [ "$RESPONSE" = "403" ]; then
26+
echo "Subscription is not valid. Reach out to support@stepsecurity.io"
27+
exit 1
28+
else
29+
echo "Timeout or API not reachable. Continuing to next step."
2830
fi
2931

3032
# `mongosh` is used starting from MongoDB 5.x

0 commit comments

Comments
 (0)