mirror of
https://github.com/mukul975/Anthropic-Cybersecurity-Skills.git
synced 2026-06-10 13:14:55 +03:00
60 lines
2.2 KiB
YAML
60 lines
2.2 KiB
YAML
# .github/workflows/star-milestones.yml
|
|
name: Star Milestone Tracker
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 * * * *'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
actions: write
|
|
|
|
jobs:
|
|
check-stars:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check star count & notify milestones
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
REPO: mukul975/Anthropic-Cybersecurity-Skills
|
|
run: |
|
|
STARS=$(curl -s -H "Authorization: token $GH_TOKEN" \
|
|
https://api.github.com/repos/$REPO | jq .stargazers_count)
|
|
echo "Current stars: $STARS"
|
|
|
|
LAST=$(curl -s -H "Authorization: token $GH_TOKEN" \
|
|
"https://api.github.com/repos/$REPO/actions/variables/LAST_STAR_MILESTONE" \
|
|
| jq -r '.value // "0"')
|
|
echo "Last notified milestone: $LAST"
|
|
|
|
# Highest multiple of 500 crossed but not yet notified
|
|
NOTIFY_MILESTONE=$(( (STARS / 500) * 500 ))
|
|
|
|
if [ "$NOTIFY_MILESTONE" -gt "$LAST" ] && [ "$NOTIFY_MILESTONE" -gt 0 ]; then
|
|
echo "🎉 New milestone: $NOTIFY_MILESTONE"
|
|
|
|
curl -X POST "$SLACK_WEBHOOK" \
|
|
-H 'Content-type: application/json' \
|
|
-d "{
|
|
\"text\": \"⭐ *Star Milestone Reached!*\",
|
|
\"attachments\": [{
|
|
\"color\": \"#FFD700\",
|
|
\"fields\": [
|
|
{\"title\": \"Milestone\", \"value\": \"$NOTIFY_MILESTONE stars 🎯\", \"short\": true},
|
|
{\"title\": \"Current Stars\", \"value\": \"$STARS ⭐\", \"short\": true},
|
|
{\"title\": \"Repo\", \"value\": \"$REPO\", \"short\": false}
|
|
]
|
|
}]
|
|
}"
|
|
|
|
curl -s -X PATCH \
|
|
-H "Authorization: token $GH_TOKEN" \
|
|
-H "Content-type: application/json" \
|
|
"https://api.github.com/repos/$REPO/actions/variables/LAST_STAR_MILESTONE" \
|
|
-d "{\"name\":\"LAST_STAR_MILESTONE\",\"value\":\"$NOTIFY_MILESTONE\"}"
|
|
else
|
|
NEXT=$(( (STARS / 500 + 1) * 500 ))
|
|
echo "No new milestone. Next at $NEXT stars ($(( NEXT - STARS )) to go)"
|
|
fi
|