-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (61 loc) · 2.44 KB
/
Copy pathstargazer-tracker.yml
File metadata and controls
69 lines (61 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Stargazer Tracker
on:
watch:
types: [started] # fires when someone stars the repo
workflow_dispatch:
schedule:
- cron: "0 7 * * 1" # weekly full refresh on Mondays at 07:00 UTC
permissions:
contents: write
issues: write
jobs:
log-stargazer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Refresh STARGAZERS.md
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
REPO="${GITHUB_REPOSITORY}"
TODAY="$(date -u +'%Y-%m-%d %H:%M UTC')"
# Pull full stargazer list (paginated) with starred_at timestamps
gh api -H "Accept: application/vnd.github.star+json" \
--paginate "/repos/${REPO}/stargazers" \
| jq -r '.[] | "\(.starred_at)|\(.user.login)|\(.user.html_url)"' \
> /tmp/stars.txt || true
{
echo "# ⭐ Stargazers — ${REPO}"
echo ""
echo "_Auto-updated ${TODAY}. Most recent first._"
echo ""
echo "| Date | User | Profile |"
echo "|---|---|---|"
sort -r /tmp/stars.txt \
| awk -F'|' '{printf "| %s | @%s | <%s> |\n", substr($1,1,10), $2, $3}'
} > STARGAZERS.md
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
if ! git diff --quiet STARGAZERS.md 2>/dev/null; then
git add STARGAZERS.md
git commit -m "chore: refresh stargazer log"
git push
else
echo "No stargazer changes."
fi
- name: Open issue welcoming the new stargazer
if: github.event_name == 'watch'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
USER="${{ github.event.sender.login }}"
# Skip if it's the repo owner self-starring
if [ "$USER" = "${{ github.repository_owner }}" ]; then
echo "Owner self-star — skipping notification."
exit 0
fi
gh issue create \
--title "⭐ New stargazer: @${USER}" \
--body "[@${USER}](https://github.com/${USER}) just starred this repo.\n\nProfile: https://github.com/${USER}\n\n_This issue is auto-created. Close after reviewing — useful for recruiter / hiring-manager tracking._" \
--label "stargazer" || echo "Label may not exist; skipping label."