-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (48 loc) · 1.71 KB
/
update-stats.yml
File metadata and controls
57 lines (48 loc) · 1.71 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
name: Update Statistics & News
on:
schedule:
- cron: '0 6 * * *'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
update-stats:
runs-on: ubuntu-latest
steps:
- name: Checkout website repo
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Generate statistics
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: node scripts/generate-stats.js
- name: Generate release notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: node scripts/generate-release-notes.js
- name: Update homepage tool stats (static)
run: node scripts/build-homepage-stats.js
- name: Cleanup old history (keep 90 days)
run: |
find data/history -name "*.json" -mtime +90 -delete 2>/dev/null || true
- name: Create PR with updated data
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add data/ index.html
if git diff --staged --quiet; then
echo "No changes to commit"
exit 0
fi
BRANCH="chore/update-stats-$(date +%Y-%m-%d)"
git checkout -b "$BRANCH"
git commit -m "chore: update statistics $(date +%Y-%m-%d)"
git push origin "$BRANCH"
gh pr create --title "chore: update statistics $(date +%Y-%m-%d)" --body "Automated daily statistics update." --base main --head "$BRANCH"
gh pr merge "$BRANCH" --auto --merge --delete-branch