mirror of
https://github.com/mukul975/Anthropic-Cybersecurity-Skills.git
synced 2026-06-12 22:24:56 +03:00
Update star.yml
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
|
# .github/workflows/star-milestones.yml
|
||||||
name: Star Milestone Tracker
|
name: Star Milestone Tracker
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -24,15 +24,16 @@ jobs:
|
|||||||
https://api.github.com/repos/$REPO | jq .stargazers_count)
|
https://api.github.com/repos/$REPO | jq .stargazers_count)
|
||||||
echo "Current stars: $STARS"
|
echo "Current stars: $STARS"
|
||||||
|
|
||||||
# Get last notified milestone
|
# Get last notified milestone — separate body and status code
|
||||||
LAST_RESPONSE=$(curl -s -w "\n%{http_code}" \
|
BODY=$(curl -s -o /tmp/var_response.json -w "%{http_code}" \
|
||||||
-H "Authorization: token $GH_TOKEN" \
|
-H "Authorization: token $GH_TOKEN" \
|
||||||
"https://api.github.com/repos/$REPO/actions/variables/LAST_STAR_MILESTONE")
|
"https://api.github.com/repos/$REPO/actions/variables/LAST_STAR_MILESTONE")
|
||||||
HTTP_STATUS=$(echo "$LAST_RESPONSE" | tail -n1)
|
HTTP_STATUS="$BODY"
|
||||||
LAST=$(echo "$LAST_RESPONSE" | head -n1 | jq -r '.value // "0"')
|
echo "HTTP status: $HTTP_STATUS"
|
||||||
|
|
||||||
# If variable doesn't exist yet, treat as 0
|
if [ "$HTTP_STATUS" = "200" ]; then
|
||||||
if [ "$HTTP_STATUS" = "404" ]; then
|
LAST=$(jq -r '.value // "0"' /tmp/var_response.json)
|
||||||
|
else
|
||||||
LAST="0"
|
LAST="0"
|
||||||
fi
|
fi
|
||||||
echo "Last notified milestone: $LAST"
|
echo "Last notified milestone: $LAST"
|
||||||
@@ -40,7 +41,6 @@ jobs:
|
|||||||
# Calculate highest multiple of 500 crossed
|
# Calculate highest multiple of 500 crossed
|
||||||
NOTIFY_MILESTONE=$(( (STARS / 500) * 500 ))
|
NOTIFY_MILESTONE=$(( (STARS / 500) * 500 ))
|
||||||
NEXT=$(( (STARS / 500 + 1) * 500 ))
|
NEXT=$(( (STARS / 500 + 1) * 500 ))
|
||||||
|
|
||||||
echo "Current milestone: $NOTIFY_MILESTONE | Next: $NEXT ($(( NEXT - STARS )) stars to go)"
|
echo "Current milestone: $NOTIFY_MILESTONE | Next: $NEXT ($(( NEXT - STARS )) stars to go)"
|
||||||
|
|
||||||
if [ "$NOTIFY_MILESTONE" -gt "$LAST" ] && [ "$NOTIFY_MILESTONE" -gt 0 ]; then
|
if [ "$NOTIFY_MILESTONE" -gt "$LAST" ] && [ "$NOTIFY_MILESTONE" -gt 0 ]; then
|
||||||
@@ -62,9 +62,8 @@ jobs:
|
|||||||
}]
|
}]
|
||||||
}"
|
}"
|
||||||
|
|
||||||
# Update or create the variable
|
# Create or update variable
|
||||||
if [ "$HTTP_STATUS" = "404" ]; then
|
if [ "$HTTP_STATUS" = "404" ]; then
|
||||||
# Create variable
|
|
||||||
curl -s -X POST \
|
curl -s -X POST \
|
||||||
-H "Authorization: token $GH_TOKEN" \
|
-H "Authorization: token $GH_TOKEN" \
|
||||||
-H "Content-type: application/json" \
|
-H "Content-type: application/json" \
|
||||||
@@ -72,7 +71,6 @@ jobs:
|
|||||||
-d "{\"name\":\"LAST_STAR_MILESTONE\",\"value\":\"$NOTIFY_MILESTONE\"}"
|
-d "{\"name\":\"LAST_STAR_MILESTONE\",\"value\":\"$NOTIFY_MILESTONE\"}"
|
||||||
echo "Created LAST_STAR_MILESTONE = $NOTIFY_MILESTONE"
|
echo "Created LAST_STAR_MILESTONE = $NOTIFY_MILESTONE"
|
||||||
else
|
else
|
||||||
# Update variable
|
|
||||||
curl -s -X PATCH \
|
curl -s -X PATCH \
|
||||||
-H "Authorization: token $GH_TOKEN" \
|
-H "Authorization: token $GH_TOKEN" \
|
||||||
-H "Content-type: application/json" \
|
-H "Content-type: application/json" \
|
||||||
|
|||||||
Reference in New Issue
Block a user