-
Notifications
You must be signed in to change notification settings - Fork 5
70 lines (59 loc) · 1.92 KB
/
update_stats.yml
File metadata and controls
70 lines (59 loc) · 1.92 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
name: Update GitHub Stats SVG
on:
schedule:
- cron: '0 * * * *'
workflow_dispatch:
permissions:
contents: write
jobs:
update-stats:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: npm install
- name: Generate GitHub stats SVG
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EXCLUDED_LANGS: ${{ secrets.EXCLUDED_LANGS }}
EXCLUDED_REPOS: ${{ secrets.EXCLUDED_REPOS }}
run: |
node src/generators/stats_commits.js
node src/generators/stats_general.js
node src/generators/stats_langs.js
node src/generators/stats_visitors.js
- name: Setup Git identity
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Switch to the main branch
run: |
git fetch origin main
git checkout main
git pull origin main
- name: Indexing and adding SVG
run: |
git add output/*.svg
- name: Commit and push updated SVG
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
git commit -m "chore: update GitHub stats SVG (manual run)" --allow-empty
git push origin main
else
if git diff --cached --quiet; then
echo "No changes found, commit skipped."
else
git commit -m "chore: update GitHub stats SVG"
git push origin main
fi
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}