Daily Polyratings DB Dump #3732
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: Daily Polyratings DB Dump | |
on: | |
schedule: | |
- cron: "13 */6 * * *" | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
db-dumper: | |
name: Polyratings Database Dumper | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
with: | |
ref: 'master' | |
- name: Run Python Script | |
uses: nick-fields/retry@v2 | |
env: | |
POLYRATINGS_USERNAME: ${{ secrets.POLYRATINGS_USERNAME }} | |
POLYRATINGS_PASSWORD: ${{ secrets.POLYRATINGS_PASSWORD }} | |
with: | |
command: 'python3 dump-professors.py' | |
max_attempts: 3 | |
timeout_minutes: 5 | |
- name: Get Current Date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H:%M:%SZ')" | |
- name: Commit Generated Files | |
run: | | |
git stash --include-untracked | |
git fetch | |
git checkout data | |
rm prof* || echo "Could not remove prof files, likely don't exist" | |
git stash pop | |
git add professor-dump.json professor-list.json | |
git config --global user.email "[email protected]" | |
git config --global user.name "Addison Tustin" | |
git diff --quiet && git diff --staged --quiet || git commit -m "Upload new DB dump at ${{ steps.date.outputs.date }}" | |
git push origin data --force | |