Process daily small boats data #821
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: Process daily small boats data | |
on: | |
repository_dispatch: | |
schedule: | |
- cron: '30 12 * * *' | |
jobs: | |
scheduled: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get current date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y-%m-%d')" | |
- 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 scripts/requirements.txt | |
- name: Process the data | |
run: |- | |
python scripts/process_dsb.py ${{ steps.date.outputs.date }} data/daily_small_boats/${{ steps.date.outputs.date }}.html data/daily_small_boats/data.csv | |
- name: Commit and push the data if it changed | |
run: |- | |
git config user.name "Automated" | |
git config user.email "[email protected]" | |
git add -A | |
timestamp=$(date -u) | |
git commit -m "Latest processed data for daily small boats: ${timestamp}" || exit 0 | |
git push |