Update data #85307
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 data | |
on: | |
workflow_dispatch: | |
# schedule: | |
# # Run every 30 minutes on the UTC time range 12:00 PM UTC to 02:00 AM UTC | |
# - cron: '*/30 12-23 * * *' | |
# - cron: '*/30 0-2 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.7] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r ./scripts/requirements.txt | |
- name: Create gspread credentials | |
run: | | |
mkdir -p ~/.config/gspread/ | |
touch ~/.config/gspread/service_account.json | |
eval "echo \"$GSPREAD_CRED\" | base64 -di >~/.config/gspread/service_account.json" | |
shell: bash | |
env: | |
GSPREAD_CRED: ${{secrets.GSPREAD_CRED}} | |
- name: Run incremental (Update Google Spreadsheets) and batch update (Dump GS to CSV file) | |
run: | | |
cd ./scripts | |
# python historic.py | |
python incremental.py | |
python batch.py | |
python assets.py | |
- name: Commit changes | |
run: | | |
rm -rf ./.git/index.lock | |
git config --local user.email "covid-19-uy-vacc-data[action]@users.noreply.github.com" | |
git config --local user.name "covid-19-uy-vacc-data[action]" | |
git add data/* | |
git add web/charts/* | |
git diff-index --quiet HEAD || git commit -m "Update" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |