Skip to content

Commit 4056d3e

Browse files
authored
Merge pull request #15 from step-security/fix/banner
Fix/banner
2 parents d8f09a2 + 00853b2 commit 4056d3e

3 files changed

Lines changed: 40 additions & 17 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:25-alpine3.23@sha256:b9b5737eabd423ba73b21fe2e82332c0656d571daf1ebf19b0f89d0dd0d3ca93
1+
FROM node:25-alpine3.23@sha256:636c5bc8fa6a7a542bc99f25367777b0b3dd0db7d1ca3959d14137a1ac80bde2
22
RUN apk add --no-cache bash>5.0.16-r0 git>2.26.0-r0 curl
33
COPY entrypoint.sh /entrypoint.sh
44
RUN chmod +x /entrypoint.sh

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[![StepSecurity Maintained Action](https://raw.githubusercontent.com/step-security/maintained-actions-assets/main/assets/maintained-action-banner.png)](https://docs.stepsecurity.io/actions/stepsecurity-maintained-actions)
2+
13
### GitHub Action - Markdown link check 🔗✔️
24

35
This GitHub action checks all Markdown files in your repository for broken links.

entrypoint.sh

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,43 @@
33
set -eu
44

55
# validate subscription status
6-
API_URL="https://agent.api.stepsecurity.io/v1/github/$GITHUB_REPOSITORY/actions/subscription"
7-
8-
# Set a timeout for the curl command (3 seconds)
9-
RESPONSE=$(curl --max-time 3 -s -w "%{http_code}" "$API_URL" -o /dev/null) || true
10-
CURL_EXIT_CODE=$?
11-
12-
# Decide based on curl exit code and HTTP status
13-
if [ $CURL_EXIT_CODE -ne 0 ]; then
14-
echo "Timeout or API not reachable. Continuing to next step."
15-
elif [ "$RESPONSE" = "200" ]; then
16-
:
17-
elif [ "$RESPONSE" = "403" ]; then
18-
echo "Subscription is not valid. Reach out to support@stepsecurity.io"
19-
exit 1
20-
else
21-
echo "Timeout or API not reachable. Continuing to next step."
6+
UPSTREAM="gaurav-nelson/github-action-markdown-link-check"
7+
ACTION_REPO="${GITHUB_ACTION_REPOSITORY:-}"
8+
DOCS_URL="https://docs.stepsecurity.io/actions/stepsecurity-maintained-actions"
9+
10+
echo ""
11+
echo -e "\033[1;36mStepSecurity Maintained Action\033[0m"
12+
echo "Secure drop-in replacement for $UPSTREAM"
13+
if [ "$REPO_PRIVATE" = "false" ]; then
14+
echo -e "\033[32m✓ Free for public repositories\033[0m"
15+
fi
16+
echo -e "\033[36mLearn more:\033[0m $DOCS_URL"
17+
echo ""
18+
19+
if [ "$REPO_PRIVATE" != "false" ]; then
20+
SERVER_URL="${GITHUB_SERVER_URL:-https://github.com}"
21+
22+
if [ "$SERVER_URL" != "https://github.com" ]; then
23+
BODY=$(printf '{"action":"%s","ghes_server":"%s"}' "$ACTION_REPO" "$SERVER_URL")
24+
else
25+
BODY=$(printf '{"action":"%s"}' "$ACTION_REPO")
26+
fi
27+
28+
API_URL="https://agent.api.stepsecurity.io/v1/github/$GITHUB_REPOSITORY/actions/maintained-actions-subscription"
29+
30+
RESPONSE=$(curl --max-time 3 -s -w "%{http_code}" \
31+
-X POST \
32+
-H "Content-Type: application/json" \
33+
-d "$BODY" \
34+
"$API_URL" -o /dev/null) && CURL_EXIT_CODE=0 || CURL_EXIT_CODE=$?
35+
36+
if [ $CURL_EXIT_CODE -ne 0 ]; then
37+
echo "Timeout or API not reachable. Continuing to next step."
38+
elif [ "$RESPONSE" = "403" ]; then
39+
echo -e "::error::\033[1;31mThis action requires a StepSecurity subscription for private repositories.\033[0m"
40+
echo -e "::error::\033[31mLearn how to enable a subscription: $DOCS_URL\033[0m"
41+
exit 1
42+
fi
2243
fi
2344

2445
NC='\033[0m' # No Color

0 commit comments

Comments
 (0)