Skip to content

Commit 667b9f6

Browse files
authored
Create update_citations.yml
1 parent ae7d178 commit 667b9f6

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Update Google Scholar citations badge
2+
3+
on:
4+
schedule:
5+
- cron: '0 6 * * *' # every day at 06:00 UTC
6+
workflow_dispatch: # allow manual run from Actions tab
7+
8+
jobs:
9+
update-citations:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
persist-credentials: true
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.x'
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install requests beautifulsoup4
29+
30+
- name: Update citations JSON
31+
run: |
32+
python scripts/update_citations.py
33+
34+
- name: Commit and push if changed
35+
run: |
36+
if git status --porcelain | grep -q 'assets/json/citations.json'; then
37+
git config user.name "github-actions[bot]"
38+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
39+
git add assets/json/citations.json
40+
git commit -m "Update Google Scholar citations badge"
41+
git push
42+
else
43+
echo "No changes in assets/json/citations.json"
44+
fi

0 commit comments

Comments
 (0)