From 780757902b7faeb8d77d034d4faead329cdd6539 Mon Sep 17 00:00:00 2001 From: Mahipal <42860185+mukul975@users.noreply.github.com> Date: Wed, 15 Apr 2026 19:15:45 +0200 Subject: [PATCH] Create star.yml --- .github/workflows/star.yml | 59 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/star.yml diff --git a/.github/workflows/star.yml b/.github/workflows/star.yml new file mode 100644 index 00000000..35ca4dde --- /dev/null +++ b/.github/workflows/star.yml @@ -0,0 +1,59 @@ +# .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