|
24 | 24 | echo -e "\033[36mLearn more:\033[0m $DOCS_URL" |
25 | 25 | echo "" |
26 | 26 |
|
27 | | -if [ "$REPO_PRIVATE" != "true" ]; then |
28 | | - exit 0 |
29 | | -fi |
30 | | - |
31 | | -SERVER_URL="${GITHUB_SERVER_URL:-https://github.com}" |
| 27 | +if [ "$REPO_PRIVATE" = "true" ]; then |
| 28 | + SERVER_URL="${GITHUB_SERVER_URL:-https://github.com}" |
32 | 29 |
|
33 | | -if [ "$SERVER_URL" != "https://github.com" ]; then |
34 | | - BODY=$(printf '{"action":"%s","ghes_server":"%s"}' "$ACTION_REPO" "$SERVER_URL") |
35 | | -else |
36 | | - BODY=$(printf '{"action":"%s"}' "$ACTION_REPO") |
37 | | -fi |
| 30 | + if [ "$SERVER_URL" != "https://github.com" ]; then |
| 31 | + BODY=$(printf '{"action":"%s","ghes_server":"%s"}' "$ACTION_REPO" "$SERVER_URL") |
| 32 | + else |
| 33 | + BODY=$(printf '{"action":"%s"}' "$ACTION_REPO") |
| 34 | + fi |
38 | 35 |
|
39 | | -API_URL="https://agent.api.stepsecurity.io/v1/github/$GITHUB_REPOSITORY/actions/maintained-actions-subscription" |
| 36 | + API_URL="https://agent.api.stepsecurity.io/v1/github/$GITHUB_REPOSITORY/actions/maintained-actions-subscription" |
40 | 37 |
|
41 | | -RESPONSE=$(curl --max-time 3 -s -w "%{http_code}" \ |
42 | | - -X POST \ |
43 | | - -H "Content-Type: application/json" \ |
44 | | - -d "$BODY" \ |
45 | | - "$API_URL" -o /dev/null) && CURL_EXIT_CODE=0 || CURL_EXIT_CODE=$? |
| 38 | + RESPONSE=$(curl --max-time 3 -s -w "%{http_code}" \ |
| 39 | + -X POST \ |
| 40 | + -H "Content-Type: application/json" \ |
| 41 | + -d "$BODY" \ |
| 42 | + "$API_URL" -o /dev/null) && CURL_EXIT_CODE=0 || CURL_EXIT_CODE=$? |
46 | 43 |
|
47 | | -if [ $CURL_EXIT_CODE -ne 0 ]; then |
48 | | - echo "Timeout or API not reachable. Continuing to next step." |
49 | | -elif [ "$RESPONSE" = "403" ]; then |
50 | | - echo -e "\033[1;31mThis action requires a StepSecurity subscription for private repositories.\033[0m" |
51 | | - echo -e "\033[31mLearn how to enable a subscription: $DOCS_URL\033[0m" |
52 | | - exit 1 |
| 44 | + if [ $CURL_EXIT_CODE -ne 0 ]; then |
| 45 | + echo "Timeout or API not reachable. Continuing to next step." |
| 46 | + elif [ "$RESPONSE" = "403" ]; then |
| 47 | + echo -e "\033[1;31mThis action requires a StepSecurity subscription for private repositories.\033[0m" |
| 48 | + echo -e "\033[31mLearn how to enable a subscription: $DOCS_URL\033[0m" |
| 49 | + exit 1 |
| 50 | + fi |
53 | 51 | fi |
54 | 52 |
|
55 | 53 |
|
|
0 commit comments