Update website contents #464
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Update website contents' | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
push: | |
branches: | |
- 'master' | |
workflow_dispatch: | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: 'Ensure git is installed' | |
run: sudo apt install -y git | |
- name: 'Ensure python is installed' | |
run: sudo apt install -y python3 | |
- name: 'Workaround: ensure requests us up to date to avoid url parsing errors' | |
run: python3 -m pip install --upgrade requests | |
- name: 'Checkout all branches' | |
uses: actions/checkout@v2 | |
- name: 'Run python script' | |
run: cd script && python3 orcid-crawl.py ${{ secrets.ORCID_ACCESS_TOKEN }} | |
- name: 'Check for changes and commit them' | |
run: | | |
lines=$(git status --porcelain=v1 | wc -l) | |
if [ $lines -gt 0 ]; then | |
git config --global user.name 'SSV' | |
git config --global user.email 'ssv@unive.it' | |
git add -A | |
git commit -m "Automatic website update from $(date)" | |
git push origin master | |
fi |