Update Data #8692
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: Update Data | |
on: | |
schedule: | |
# run every x minutes (/30 every 30minutes) | |
- cron: '0 * * * *' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Run the app | |
run: | | |
python index.py -u | |
- name: Commit files | |
run: | | |
echo "Checking data on: `date`" | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "New update available" | |
git config --local user.name actions-user | |
git config --local user.email "[email protected]" | |
git add ./data/*.json | |
git commit -am "Update data - $(date '+%y%m%d_%H%M')" | |
git push origin master | |
else | |
echo "no changes to commit" | |
fi |