Update daily #7301
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 daily | |
on: | |
workflow_dispatch: | |
schedule: | |
# Run every day at 7 AM UTC and every 30 minutes from 0AM UTC to 4AM UTC | |
- cron: '0 10 * * *' | |
- cron: '*/30 0-4 * * *' | |
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 | |
run: | | |
cd ./scripts | |
python deaths.py | |
python batch.py | |
timeout-minutes: 5 | |
- 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" | |
timeout-minutes: 5 | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |