Scheduled Update #37488
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: Scheduled Update | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- 'data/**' | |
schedule: | |
- cron: "30 * * * *" | |
jobs: | |
scrape_and_update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies with pipenv | |
run: | | |
pip install pipenv | |
pipenv install --deploy --dev | |
- name: Perform update | |
run: pipenv run python scrape.py | tee /tmp/update-run.txt | |
- name: Generate metadata | |
run: pipenv run python generate_metadata.py | tee -a /tmp/update-run.txt | |
- name: Commit files | |
run: | | |
git config --local user.email "bot@ufrgs.dev" | |
git config --local user.name "inf-bot" | |
git add --all | |
for data in $(ls -d data/*/); do test -z "$(git diff-index HEAD | grep $data | grep -v README)" && git restore --staged -- $data; done | |
git status | |
git commit -m "Scheduled updates ($(date +'%F %T %Z'))" || true | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Ensure everything is working | |
run: | | |
test -z "$(cat /tmp/update-run.txt | grep Failed)" | |
test -z "$(cat /tmp/update-run.txt | grep Traceback)" |