Skip to content

Commit d417e1e

Browse files
authored
Merge pull request #53 from step-security/fix/subscripiton
fix: fixed subscription check code
2 parents 8664d85 + b670242 commit d417e1e

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

entrypoint.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@ API_URL="https://agent.api.stepsecurity.io/v1/github/$GITHUB_REPOSITORY/actions/
77
RESPONSE=$(curl --max-time 3 -s -w "%{http_code}" "$API_URL" -o /dev/null) || true
88
CURL_EXIT_CODE=${?}
99

10-
# Check if the response code is not 200
11-
if [ "$CURL_EXIT_CODE" -ne 0 ] || [ "$RESPONSE" != "200" ]; then
12-
if [ -z "$RESPONSE" ] || [ "$RESPONSE" = "000" ] || [ "$CURL_EXIT_CODE" -ne 0 ]; then
13-
echo "Timeout or API not reachable. Continuing to next step."
14-
else
15-
echo "Subscription is not valid. Reach out to support@stepsecurity.io"
16-
exit 1
17-
fi
10+
# Decide based on curl exit code and HTTP status
11+
if [ $CURL_EXIT_CODE -ne 0 ]; then
12+
echo "Timeout or API not reachable. Continuing to next step."
13+
elif [ "$RESPONSE" = "200" ]; then
14+
:
15+
elif [ "$RESPONSE" = "403" ]; then
16+
echo "Subscription is not valid. Reach out to support@stepsecurity.io"
17+
exit 1
18+
else
19+
echo "Timeout or API not reachable. Continuing to next step."
1820
fi
1921

2022
# Copy the matcher to the host system; otherwise "add-matcher" can't find it.

0 commit comments

Comments
 (0)