-
Notifications
You must be signed in to change notification settings - Fork 12
88 lines (74 loc) · 2.77 KB
/
main.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Workflow to Automatically Update Data Sources in the Repository
name: Automated Data Updates
# Controls when the action will run.
on:
# Time-based workflow trigger (at 00:00, 08:00, 16:00)
schedule:
- cron: "0 0,8,10,16 * * *"
# The job executed by the workflow
jobs:
# This workflow contains a single job called "update_data_sources"
update_data_sources:
# This job runs on Linux using Python 3.7 version
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]
# The sequence of tasks that will be executed as part of the job
steps:
# Checks-out the repository under $GITHUB_WORKSPACE, so the job can access it
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r ${{ github.workspace }}/.github/workflows/requirements.txt
- name: Configure Git Credentials
run: |
echo ${{ github.workspace }}
git config --local user.email "action@agithub.com"
git config --local user.name "GitHub Action"
- name: Update general data
run: |
cd ${{ github.workspace }}/data/all_countries/general/
echo Updating all_countries general source..
python download.py
python extract_json.py
cd ${{ github.workspace }}/data/greece/general/
python extract_json_greece.py
- name: Update regional data
run: |
cd ${{ github.workspace }}/data/greece/regional/
echo Updating regional source..
python download_gr_data.py
python download_wm_data.py
- name: Update refugee camps data
run: |
cd ${{ github.workspace }}/data/greece/refugee_camps/
echo Updating refugee camps source..
python download.py
# - name: Update schools status data
# run: |
# cd ${{ github.workspace }}/data/greece/schools_status/
# echo Updating schools status source..
# python webcrawler.py
# echo Done.
- name: Update vaccinations data
env:
TOKEN_VACCINES: ${{ secrets.TOKEN_VACCINES }}
run: |
cd ${{ github.workspace }}/data/greece/vaccines/
echo Updating vaccinations data source..
python download_vaccines_data.py "$TOKEN_VACCINES"
- name: Commit files
run: |
git add -A
git commit -m "Automated Data Update using Workflows"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}