Skip to content

Update standing data #1050

Update standing data

Update standing data #1050

name: Update standing data
on:
schedule:
- cron: "0 8 * * *"
workflow_dispatch:
jobs:
update_standing_data:
name: Update standing data
runs-on: ubuntu-latest
env:
PNLD_DOWNLOAD_URL: ${{ secrets.PNLD_DOWNLOAD_URL }}
PNLD_LOGIN_URL: ${{ secrets.PNLD_LOGIN_URL }}
PNLD_PASSWORD: ${{ secrets.PNLD_PASSWORD }}
PNLD_USERNAME: ${{ secrets.PNLD_USERNAME }}
GOOGLE_API_KEY: ${{ secrets.SHEETSAPIKEY }}
SD_USERNAME: ${{ secrets.SD_USERNAME }}
SD_PASSWORD: ${{ secrets.SD_PASSWORD }}
SD_END_POINT: ${{ secrets.SD_END_POINT }}
HEADLESS: "true"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup node version
uses: actions/setup-node@v4
with:
node-version: 20.6.1
- name: Install dependencies
run: npm install
- name: Download offence code data files
run: npm run download-offence-code-data
- name: Merge offence code data files
run: npm run merge-offence-data
- name: Download Organisation Unit data files
run: npm run download-organisation-unit-data
- name: Merge Organisation Unit data files
run: npm run merge-organisation-unit-data
- name: Report Status
if: always()
uses: ravsamhq/notify-slack-action@v1
with:
status: ${{ job.status }}
notification_title: "GitHub action failed"
message_format: ":elmo-fire: *{workflow}* {status_message} in <{repo_url}|{repo}>"
notify_when: "failure"
footer: "Linked to Repo <{repo_url}|{repo}>"
env:
SLACK_WEBHOOK_URL: ${{ secrets.ACTION_MONITORING_SLACK }}
- name: Create pull request
id: cpr
uses: peter-evans/create-pull-request@v6
with:
branch: auto/update-data
delete-branch: true
committer: GitHub <noreply@github.com>
author: GitHub <noreply@github.com>
commit-message: "fix(next-data): Update standing data"
title: Update standing data
body: >
Automated standing data updates generated by the
[Update standing data](https://github.com/ministryofjustice/bichard7-next-data/actions/workflows/update-standing-data.yml)
workflow.
- name: Check PR information
run: |
echo "PR #${{ steps.cpr.outputs.pull-request-number}}"
echo "${{ steps.cpr.outputs.pull-request-url }}"