Skip to content

Fetch new data and update the repository #971

Fetch new data and update the repository

Fetch new data and update the repository #971

Workflow file for this run

name: Fetch new data and update the repository
on:
workflow_dispatch:
schedule:
- cron: "5 8 */3 * *"
jobs:
update-data:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Grab latest alltheplaces
run: |
git clone --depth=1 https://github.com/alltheplaces/alltheplaces.git
- name: Run USPS spider
run: |
cd alltheplaces
uv run --with scrapy scrapy runspider locations/spiders/usps_collection_boxes.py --output ../usps_collection_boxes.ndjson:ndgeojson --loglevel=ERROR
- name: Sort the data
run: |
mkdir -p data
python sort.py usps_collection_boxes.ndjson usps_collection_boxes_sorted.ndjson --prefix-dir=data --prefix-chars=3
- name: Push changes to remote
run: |
git config user.email "ian.dees+bot@gmail.com"
git config user.name "USPS Bot"
echo "$(date +%Y-%m-%dT%H:%M:%SZ)" > data/last_updated.txt
git add data
git commit -m "Adding data from $(date +%Y-%m-%d)"
git push origin master