Skip to content

Commit 7e058b2

Browse files
authored
Update update_citations.yml
1 parent b8cd8f0 commit 7e058b2

File tree

1 file changed

+24
-39
lines changed

1 file changed

+24
-39
lines changed
Lines changed: 24 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,29 @@
1-
name: Update Google Scholar citations badge
1+
name: Get Citation Data
22

3-
on:
4-
schedule:
5-
- cron: '0 6 * * *' # every day at 06:00 UTC
6-
workflow_dispatch: # allow manual run from Actions tab
3+
on:
4+
page_build:
5+
schedule:
6+
- cron: '0 8 * * *'
77

88
jobs:
9-
update-citations:
9+
build:
1010
runs-on: ubuntu-latest
11-
permissions:
12-
contents: write
13-
1411
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
12+
- uses: actions/checkout@v2
13+
- name: Install Reqs
14+
run: |
15+
sudo apt-get install python3-setuptools
16+
- name: Run
17+
run: |
18+
cd ./google_scholar_crawler
19+
pip3 install -r requirements.txt
20+
python3 main.py
21+
cd ./results
22+
git init
23+
git config --local user.name "${GITHUB_ACTOR}"
24+
export remote_repo="https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
25+
git add *.json
26+
git commit -m "Updated Citation Data"
27+
git push "${remote_repo}" HEAD:google-scholar-stats --force
28+
env:
29+
GOOGLE_SCHOLAR_ID: ${{ secrets.GOOGLE_SCHOLAR_ID }}

0 commit comments

Comments
 (0)