-
Notifications
You must be signed in to change notification settings - Fork 9
45 lines (42 loc) · 1.22 KB
/
update_downloads.yml
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
name: Update Download Stats
on:
schedule:
- cron: '0 0 * * *'
push:
branches:
- main
workflow_dispatch:
jobs:
update-downloads:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: pip install requests
- name: Run download script
id: run-script
run: |
python3 scripts/v2/count_downloads.py
echo "total_downloads=$(cat total_downloads.txt)" >> $GITHUB_ENV
- name: Update README
run: |
sed -i "s/Total downloads: [0-9]\+/Total downloads: ${{ env.total_downloads }}/" README.md
- name: Commit changes
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git add README.md
git commit -m "chore(workflow): update download stats"
- name: Push changes
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}
git push