Skip to content

Update standing data #1031

Update standing data

Update standing data #1031

name: Update standing data
on:
schedule:
- cron: "0 8 * * *"
workflow_dispatch:
jobs:
update_standing_data:
name: Update standing data
runs-on: ubuntu-latest
env:
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: wake the beast
run: npm run download-standing-data
- name: Pause before second call
run: sleep 5
- name: Download standing data from API
uses: nick-fields/retry@v3
with:
max_attempts: 5
timeout_minutes: 10
retry_on: error
command:
npm run download-standing-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: "https://hooks.slack.com/services/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"
- 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 }}"