Download WARN Data and Update Dashboard #185
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: Download WARN Data and Update Dashboard | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| release: | |
| types: [published] | |
| schedule: | |
| - cron: '0 0 * * *' # Runs daily at midnight UTC | |
| workflow_dispatch: {} # Allows manual triggering | |
| jobs: | |
| update-warn-dashboard: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| steps: | |
| - name: Checkout main repository | |
| uses: actions/checkout@v4 | |
| - name: Checkout data repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: coatless-data/warn-files | |
| token: ${{ secrets.DATA_REPO_PAT }} | |
| path: warn-data | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Download WARN data | |
| run: | | |
| # Create data directory if it doesn't exist in the data repo | |
| mkdir -p warn-data/data | |
| python .github/scripts/download-warn.py warn-data/data | |
| - name: Push updates to data repository | |
| run: | | |
| cd warn-data | |
| git config --global user.name "GitHub Actions Bot" | |
| git config --global user.email "actions@github.com" | |
| git add data/* | |
| # Only commit and push if there are changes | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Update WARN data $(date +'%Y-%m-%d')" | |
| git push | |
| fi | |
| - name: Set up Quarto | |
| uses: quarto-dev/quarto-actions/setup@v2 | |
| with: | |
| version: pre-release | |
| - name: Directory listing | |
| run: ls -R . | |
| - name: Render Quarto Project | |
| run: | | |
| quarto render | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: '_site' | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |