-
Notifications
You must be signed in to change notification settings - Fork 5
127 lines (104 loc) · 3.86 KB
/
Copy pathcommunity-digest.yml
File metadata and controls
127 lines (104 loc) · 3.86 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: Community Digest
# ---------------------------------------------------------------
# weekly community digest — creates a GitHub Issue summarizing
# what's happening in the Claude Code community.
#
# sources: reddit, hacker news, trending github repos
# output: single open issue (supersedes previous digests)
#
# cost: $0/run — no Claude API calls, just HTTP + formatting
# tested with: claude code v2.1.122
# ---------------------------------------------------------------
on:
schedule:
# weekly: friday 14:00 UTC
- cron: '0 14 * * 5'
workflow_dispatch: # manual trigger for testing
permissions:
contents: read
issues: write
concurrency:
group: "community-digest"
cancel-in-progress: false
jobs:
digest:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
# ---- setup ----
- uses: actions/checkout@v7
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install dependencies
run: pip install requests==2.32.3
# ---- collect community signals ----
- name: Collect community data
id: collect
run: python .github/scripts/collect_community.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ---- format and create issue ----
- name: Create digest issue
if: steps.collect.outputs.has_changes == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
DATE=$(date -u +%Y-%m-%d)
# ensure label exists
gh label create "community-digest" \
--description "weekly community signal digest" \
--color "c5def5" 2>/dev/null || true
# build issue body from community_changes.json
BODY=$(python3 -c "
import json, sys
with open('/tmp/community_changes.json') as f:
changes = json.load(f)
reddit = [c for c in changes if c['type'] == 'reddit_post']
hn = [c for c in changes if c['type'] == 'hn_story']
trending = [c for c in changes if c['type'] == 'trending_repo']
lines = ['## community digest — $DATE', '']
if reddit:
lines.append('### reddit highlights')
for r in reddit:
title = r['title']
url = r['url']
body = r.get('body', '')[:120].replace('\n', ' ').strip()
desc = f' — {body}' if body else ''
lines.append(f'- [{title}]({url}){desc}')
lines.append('')
if hn:
lines.append('### hacker news')
for h in hn:
title = h['title']
url = h['url']
lines.append(f'- [{title}]({url})')
lines.append('')
if trending:
lines.append('### trending repos')
for t in trending:
title = t['title']
url = t['url']
body = t.get('body', '')[:120].replace('\n', ' ').strip()
desc = f' — {body}' if body else ''
lines.append(f'- [{title}]({url}){desc}')
lines.append('')
lines.append('---')
lines.append('*auto-generated weekly digest. close if not useful.*')
print('\n'.join(lines))
")
# close previous community-digest issues (superseded)
PREV_ISSUES=$(gh issue list \
--label "community-digest" \
--state open \
--json number \
--jq '.[].number')
for ISSUE_NUM in $PREV_ISSUES; do
gh issue close "$ISSUE_NUM" \
--comment "superseded by new weekly digest" 2>/dev/null || true
done
# create new issue
gh issue create \
--title "community digest — $DATE" \
--body "$BODY" \
--label "community-digest"