-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (55 loc) · 1.76 KB
/
cron_update_bibliography.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# workflow to update the bibliograhy file if it has changed.
name: Check for updates of the bibliography and deploy if it changed
on:
# push:
# branches:
# - main
schedule:
# every hour at minute 37
- cron: "37 * * * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: write
# The following permissions are needed by the pages call if a change occured.
pages: write
id-token: write
jobs:
update_bibliography:
runs-on: ubuntu-latest
outputs:
bibliography_changes: ${{ env.BIBLIOGRAPHY_CHANGES }}
steps:
- name: clone
uses: actions/checkout@v1
- name: setup python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: run zotero python client script
id: download_and_check
env:
ZOTERO_API_KEY: ${{ secrets.ZOTERO_API_KEY }}
run: |
pip install pyzotero==1.5.5 PyYAML==6.0
python files/zotero.py
echo "BIBLIOGRAPHY_CHANGES=$(git diff --name-only | wc -l)" >> $GITHUB_ENV
- name: print_env
run: |
env
- name: push_if_updated
if: env.BIBLIOGRAPHY_CHANGES != '0'
run: |
git add _data/publications.yaml
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m "Updated bibliography"
- name: Push changes
if: env.BIBLIOGRAPHY_CHANGES != '0'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
update_pages:
needs: [update_bibliography]
if: needs.update_bibliography.outputs.bibliography_changes != '0'
uses: ./.github/workflows/jekyll.yml