API - Automated Data Updates #4988
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: API - Automated Data Updates | |
# Controls when the action will run. | |
on: | |
# Time-based workflow trigger (at 00:10, 08:10, 16:10) | |
schedule: | |
- cron: '10 0,8,16 * * *' | |
# The job executed by the workflow | |
jobs: | |
# This workflow contains a single job called "update_data_sources" | |
api_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 | |
- name: Configure Git Credentials | |
run: | | |
echo ${{ github.workspace }} | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "GitHub Actions" | |
- name: Update Data | |
run: | | |
cd ${{ github.workspace }} | |
python update_data.py | |
- name: Commit files | |
run: | | |
git add -A | |
git commit -m "Automated Data Update using Workflows" | |
- name: Push changes to master branch | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |