-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update subscription validation logic (#10)
- Loading branch information
1 parent
f069941
commit 8e5e38d
Showing
3 changed files
with
16 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,18 +3,27 @@ description: "Restore file's modified time (timestamp) based on git commits" | |
branding: | ||
icon: "check-square" | ||
color: "green" | ||
inputs: | ||
STEPSECURITY_API_KEY: | ||
description: "API key for validation" | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Validate API Key | ||
- name: Validate subscription | ||
shell: bash | ||
run: | | ||
# TODO: Validate API Key | ||
echo "Invalid API Key" | ||
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=${?} | ||
# Check if the response code is not 200 | ||
if [ $CURL_EXIT_CODE -ne 0 ] || [ "$RESPONSE" != "200" ]; then | ||
if [ -z "$RESPONSE" ] || [ "$RESPONSE" == "000" ] || [ $CURL_EXIT_CODE -ne 0 ]; then | ||
echo "Timeout or API not reachable. Continuing to next step." | ||
else | ||
echo "Subscription is not valid. Reach out to [email protected]" | ||
exit 1 | ||
fi | ||
fi | ||
- name: Run git-restore-mtime | ||
shell: bash | ||
|