Scrape Oakland calls for service #495
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: Scrape Oakland calls for service | ||
on: | ||
schedule: | ||
- cron: "0 19 * * *" | ||
workflow_dispatch: | ||
jobs: | ||
scrape: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v2 | ||
- name: Install package manager for deps | ||
run: pipx install pipenv | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.11" | ||
cache: "pipenv" | ||
- name: Install deps | ||
run: pipenv install | ||
- name: Run that scraper, please | ||
run: pipenv run python scrape.py | ||
- name: Add and commit | ||
id: add_commit | ||
uses: EndBug/add-and-commit@v8 | ||
with: | ||
add: 'raw/*.json' | ||
add: 'csv/*.csv' | ||
committer_name: Automated | ||
committer_email: actions@users.noreply.github.com | ||
message: "Latest data" | ||
notify: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- scrape # Ensure notification is sent after the scrape job | ||
if: ${{ failure() }} # Trigger only on failure ${{ failure() }} | ||
steps: | ||
- name: Notify Discord | ||
uses: nobrayner/discord-webhook@v1 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
discord-webhook: ${{ secrets.DISCORD_ALERT_WEBHOOK }} | ||
username: 'GitHub Action Pipeline Failure Notification' | ||
avatar-url: 'https://pdap.io/assets/acronym-4d931b2f.svg' | ||
title: '${{ github.repository }}: {{Status}}' | ||
description: 'The repository ${{ github.repository }} had an event: ${{ github.event_name }} which trigged this {{STATUS}}!' | ||
include-details: false | ||
color-failure: 'eb4034' |