Run Game Report and Push Updates #86
This file contains hidden or 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: Run Game Report and Push Updates | |
| on: | |
| schedule: | |
| - cron: '0 10 * * *' #run at 2am pst | |
| - cron: '0 7 * * *' #runs at 11pm pst | |
| workflow_dispatch: # Allows you to run the workflow manually if desired | |
| jobs: | |
| run-scripts: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.x" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run game_report_scrape.py | |
| working-directory: game_report | |
| run: python game_report_scrape.py | |
| - name: Run pbp_gamelogs.py | |
| working-directory: game_report | |
| run: python pbp_gamelogs.py | |
| - name: Commit changes | |
| run: | | |
| git config --global user.name "github-actions" | |
| git config --global user.email "github-actions@github.com" | |
| git add . | |
| # Only commit if there are changes | |
| git diff --cached --quiet || git commit -m "Automated update from scheduled job [skip ci]" | |
| - name: Push changes | |
| uses: ad-m/github-push-action@v0.6.0 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} |