Automated Data Updates #5920
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
# 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@agit.luolix.top" | |
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 }} |