Cardiff Central Air Quality Data #29595
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: Cardiff Central Air Quality Data | |
on: | |
repository_dispatch: | |
schedule: | |
- cron: '00 2 * * *' | |
jobs: | |
scheduled: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out this repo | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- uses: actions/cache@v4 | |
name: Configure pip caching | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install Python dependencies | |
run: | | |
pip install -r requirements.txt | |
- name: Fetch latest Cardiff Central data | |
run: |- | |
cd cardiff_central | |
#wget -q -O CARD_2022.csv https://uk-air.defra.gov.uk/datastore/data_files/site_data/CARD_2022.csv | |
# wget -q -O CARD_2023.csv https://uk-air.defra.gov.uk/datastore/data_files/site_data/CARD_2023.csv | |
wget -q -O CARD_2024.csv https://uk-air.defra.gov.uk/datastore/data_files/site_data/CARD_2024.csv | |
wget -q -O CARD_2025.csv https://uk-air.defra.gov.uk/datastore/data_files/site_data/CARD_2025.csv | |
- name: Commit and push data if it changed | |
run: |- | |
git config user.name "Automated" | |
git config user.email "actions@users.noreply.github.com" | |
git add -A | |
timestamp=$(date -u) | |
git commit -m "Latest Cardiff Central data: ${timestamp}" || exit 0 | |
git push |