Update Air Quality Data #4580
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: Update Air Quality Data | |
| on: | |
| schedule: | |
| - cron: '0 */4 * * *' # Runs every 4 hours | |
| workflow_dispatch: | |
| jobs: | |
| update-data: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: '3.x' # Replace with your desired Python version | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install requests | |
| - name: Run Python script | |
| env: | |
| AIR_QUALITY_API_KEY: ${{ secrets.AIR_QUALITY_API_KEY }} | |
| run: python air_quality.py | |
| - name: Commit changes | |
| run: | | |
| git config --local user.email "actions@github.com" | |
| git config --local user.name "GitHub Actions" | |
| git add data.json | |
| git commit -m "Update data.json" -a | |
| git push |