.github/workflows/main.yml #333
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
on: | |
schedule: | |
# Every day at 8 PM AEST | |
- cron: '0 10 * * *' | |
# allow manual workflow trigger | |
workflow_dispatch: | |
# required to push back to GitHub | |
permissions: | |
contents: write | |
jobs: | |
update_data: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repository | |
uses: actions/checkout@v3.3.0 | |
- name: setup python | |
uses: actions/setup-python@v4.5.0 | |
with: | |
python-version: '>=3.10' | |
cache: pip | |
- name: install requirements | |
run: | | |
pip install -r requirements.txt | |
- name: get data | |
run: | | |
python get_data.py | |
- name: push data back to repository | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add . | |
# Only push if the return value of git commit is success (0). | |
if git commit -m "Update data"; | |
then | |
git push | |
fi | |