Scheduled Merge and Generate CSV #6896
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 Merge and Generate CSV | |
on: | |
push: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0/6 * * *' | |
jobs: | |
merge-upstream: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out this repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetch upstream | |
run: |- | |
git config user.name "Automated" | |
git config user.email "[email protected]" | |
git remote add upstream https://github.com/nychealth/coronavirus-data.git | |
git fetch upstream | |
git merge upstream/master | |
git push origin master | |
- name: setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: install python packages | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r pressnyc/parse/requirements.txt | |
- name: execute pressnyc/parse/hospitalization-and-death.py | |
run: python pressnyc/parse/hospitalization-and-death.py | |
- name: execute pressnyc/parse/hospitalization-and-death-daily.py | |
run: python pressnyc/parse/hospitalization-and-death-daily.py | |
- name: Commit and push if it changed | |
run: |- | |
git config user.name "Automated" | |
git config user.email "[email protected]" | |
git add -A | |
timestamp=$(date -u) | |
git commit -m "Latest data: ${timestamp}" || exit 0 | |
git push |