Skip to content

Refetch All Reports

Refetch All Reports #2

Workflow file for this run

# This workflow refetches all preventable death reports from https://www.judiciary.uk/prevention-of-future-death-reports/
# using the `npm run fetch:all` command
name: Refetch All Reports
on:
schedule:
- cron: '0 1 1 * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout project
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install Fetch dependencies
run: npm ci
- name: Fetch up all date reports
if: github.event.schedule == '0 1 1 * *' || github.event_name == 'workflow_dispatch'
run: npm run fetch:all
- name: Setup Python
uses: actions/setup-python@v4.7.0
with:
python-version: 3.8
cache: 'pip'
- name: Install Analysis requirements
run: pip install -r src/analyse/counts/requirements.txt
- name: Run Analyses
run: npm run analyse:counts
- name: Run Analyses
run: npm run analyse:areas
- name: Run Analyses
run: npm run analyse:names
- name: Run Analyses
run: npm run analyse:years
- name: Run Analyses
run: npm run analyse:genders
- name: Run Analyses
run: npm run analyse:sent_to
- name: Run Analyses
run: npm run analyse:categories
- name: Update GitHub with latest reports and analysis
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "chore: fetch latest reports"
file_pattern: '**/*.csv **/latest.log **/full_fetch.log **/*.toml'
- name: Send Mail
if: github.event.schedule == '0 1 1 * *' || github.event_name == 'workflow_dispatch'
uses: dawidd6/action-send-mail@v2
with:
server_address: smtp.gmail.com
server_port: 587
username: ${{ secrets.EMAIL_USERNAME }}
password: ${{ secrets.EMAIL_PASSWORD }}
subject: 'GitHub Action Email Notification'
to: 'georgiarichardscebm@gmail.com'
from: ${{ secrets.EMAIL_USERNAME }}
body: 'Good morning! We wanted to inform you about a recent data update in our system.'
attachments: src/data/reports.csv, src/data/full_fetch.log