Update schedule data from NGTV v1 API #74769
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
name: Update schedule data from NGTV v1 API | |
on: | |
push: | |
branches: | |
- source | |
schedule: | |
- cron: '*/5 * * * *' | |
jobs: | |
fetch: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Pull Python code | |
uses: actions/checkout@v2 | |
with: | |
ref: source | |
- name: Pull existing schedule data | |
uses: actions/checkout@v2 | |
with: | |
ref: ngtv-v1 | |
path: ngtv-v1 | |
- name: Install Python dependencies | |
run: | | |
pip3 install requests | |
pip3 install datetime | |
pip3 install pytz | |
- name: Fetch latest schedule data | |
run: python3 build.py | |
- name: Detect changes | |
id: detect_changes | |
working-directory: ngtv-v1 | |
run: if [ -n "$(git status --porcelain)" ]; then echo "::set-output name=changes_detected::yes"; fi | |
- name: Push changes back to repository | |
if: steps.detect_changes.outputs.changes_detected == 'yes' | |
working-directory: ngtv-v1 | |
run: | | |
git config user.name 'Turner Schedule API' | |
git config user.email '[email protected]' | |
git config push.default simple | |
git add -A | |
git commit -m 'Database update' | |
git push |