First Scraper #484
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: First Scraper | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| state: | |
| description: 'U.S. state to scrape' | |
| required: true | |
| default: 'ia' | |
| schedule: | |
| - cron: "0 0 * * *" | |
| permissions: | |
| contents: write | |
| jobs: | |
| scrape: | |
| name: Scrape | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install scraper | |
| run: pip install warn-scraper | |
| - name: Scrape | |
| run: warn-scraper ${{ inputs.state }} --data-dir ./data/ | |
| - name: Save datestamp | |
| run: date > ./data/latest-scrape.txt | |
| - name: Commit and push | |
| run: | | |
| git config user.name "GitHub Actions" | |
| git config user.email "actions@users.noreply.github.com" | |
| git add ./data/ | |
| git commit -m "Latest data for ${{ inputs.state }}" && git push || true |