Update datasets #154
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: 'Update datasets' | |
on: | |
workflow_dispatch: | |
schedule: | |
# Dataset will be updated every Sunday at 2 AM UTC | |
- cron: '0 2 * * 0' | |
jobs: | |
update: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@main | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Set up Python and cache poetry dependencies | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.10.8 | |
cache: poetry | |
- name: Install dependencies | |
run: poetry install --no-root | |
- name: Fetch all datasets | |
# Load github secrets stored variables into environment | |
env: | |
USER_FULL_NAME: ${{ secrets.USER_FULL_NAME}} | |
USER_ORGANIZATION: ${{ secrets.USER_ORGANIZATION}} | |
USER_EMAIL: ${{ secrets.USER_EMAIL}} | |
run: | | |
poetry run python japan_aqi.py | |
- name: Commit files | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add data/japan-aqi/* | |
git commit --allow-empty -m "Auto-update of AQI data" -a | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |