From c2171b595a8c9b52732afee87909430a7966ba6f Mon Sep 17 00:00:00 2001 From: Anurag Rajawat Date: Thu, 23 Apr 2026 15:06:23 +0530 Subject: [PATCH 1/2] feat: added banner and update subscription check to make maintained actions free for public repos Signed-off-by: Anurag Rajawat --- README.md | 2 ++ action.yml | 60 +++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 43 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 4601ea0..22bab37 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![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) + [![Test](https://github.com/step-security/github-api-commit-action/actions/workflows/test.yml/badge.svg)](https://github.com/step-security/github-api-commit-action/actions/workflows/test.yml) # GitHub Api Commit diff --git a/action.yml b/action.yml index c59c5d7..2a44eb7 100644 --- a/action.yml +++ b/action.yml @@ -29,27 +29,49 @@ runs: using: 'composite' steps: - name: Subscription check - shell: bash + env: + REPO_PRIVATE: ${{ github.event.repository.private }} run: | - # validate subscription status - API_URL="https://agent.api.stepsecurity.io/v1/github/$GITHUB_REPOSITORY/actions/subscription" - - # Set a timeout for the curl command (3 seconds) - RESPONSE=$(curl --max-time 3 -s -w "%{http_code}" "$API_URL" -o /dev/null) || true - CURL_EXIT_CODE=$? - - # Decide based on curl exit code and HTTP status - if [ $CURL_EXIT_CODE -ne 0 ]; then - echo "Timeout or API not reachable. Continuing to next step." - elif [ "$RESPONSE" = "200" ]; then - : - elif [ "$RESPONSE" = "403" ]; then - echo "Subscription is not valid. Reach out to support@stepsecurity.io" - exit 1 - else - echo "Timeout or API not reachable. Continuing to next step." + UPSTREAM="step-security/github-api-commit-action" + ACTION_REPO="${GITHUB_ACTION_REPOSITORY:-}" + DOCS_URL="https://docs.stepsecurity.io/actions/stepsecurity-maintained-actions" + + echo "" + echo -e "\033[1;36mStepSecurity Maintained Action\033[0m" + echo "Secure drop-in replacement for $UPSTREAM" + if [ "$REPO_PRIVATE" = "false" ]; then + echo -e "\033[32m✓ Free for public repositories\033[0m" fi - + echo -e "\033[36mLearn more:\033[0m $DOCS_URL" + echo "" + + if [ "$REPO_PRIVATE" != "false" ]; then + SERVER_URL="${GITHUB_SERVER_URL:-https://github.com}" + + if [ "$SERVER_URL" != "https://github.com" ]; then + BODY=$(printf '{"action":"%s","ghes_server":"%s"}' "$ACTION_REPO" "$SERVER_URL") + else + BODY=$(printf '{"action":"%s"}' "$ACTION_REPO") + fi + + API_URL="https://agent.api.stepsecurity.io/v1/github/$GITHUB_REPOSITORY/actions/maintained-actions-subscription" + + RESPONSE=$(curl --max-time 3 -s -w "%{http_code}" \ + -X POST \ + -H "Content-Type: application/json" \ + -d "$BODY" \ + "$API_URL" -o /dev/null) && CURL_EXIT_CODE=0 || CURL_EXIT_CODE=$? + + if [ $CURL_EXIT_CODE -ne 0 ]; then + echo "Timeout or API not reachable. Continuing to next step." + elif [ "$RESPONSE" = "403" ]; then + echo -e "::error::\033[1;31mThis action requires a StepSecurity subscription for private repositories.\033[0m" + echo -e "::error::\033[31mLearn how to enable a subscription: $DOCS_URL\033[0m" + exit 1 + fi + fi + shell: bash + - name: Setup commit context shell: bash id: commit-context From 406f87e6a234deac7188fadd259a995d0b92a250 Mon Sep 17 00:00:00 2001 From: Raj-StepSecurity Date: Tue, 12 May 2026 10:40:18 +0530 Subject: [PATCH 2/2] feat: author name corrected --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 2a44eb7..1e78eb2 100644 --- a/action.yml +++ b/action.yml @@ -32,7 +32,7 @@ runs: env: REPO_PRIVATE: ${{ github.event.repository.private }} run: | - UPSTREAM="step-security/github-api-commit-action" + UPSTREAM="grafana/github-api-commit-action" ACTION_REPO="${GITHUB_ACTION_REPOSITORY:-}" DOCS_URL="https://docs.stepsecurity.io/actions/stepsecurity-maintained-actions" @@ -249,4 +249,4 @@ runs: BRANCH: ${{ steps.commit-context.outputs.branch }} REPO: ${{ steps.commit-context.outputs.repo }} COMMIT_MESSAGE: ${{ inputs.commit-message }} - TEMP_CONTENTS_DIR: ${{ steps.additions-and-deletions.outputs.contents_dir }} \ No newline at end of file + TEMP_CONTENTS_DIR: ${{ steps.additions-and-deletions.outputs.contents_dir }}