-
Notifications
You must be signed in to change notification settings - Fork 8
58 lines (54 loc) · 1.77 KB
/
update_daily.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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 }}