AQI Charts and Maps #1256
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: AQI Charts and Maps | |
| on: | |
| schedule: | |
| - cron: '0,30 23,0,1,2,3,4,5,6 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| generate-aqimap-and-datafile: | |
| runs-on: ubuntu-latest | |
| env: | |
| TZ: Asia/Colombo | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.12' | |
| - name: Cache Python dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| pip install -r requirements.txt | |
| - name: Generate all stations map | |
| run: python all_stations_map.py | |
| - name: Generate daily data file | |
| run: python daily_data_file.py | |
| - name: Commit and push generated files | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config --global user.name "OrgBot" | |
| git config --global user.email "noreply@github.com" | |
| git add all_stations_maps/* charts/* | |
| git diff --cached --quiet || git commit -m "Update: maps and charts" | |
| git pull --rebase | |
| git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} HEAD:${{ github.ref }} |