Skip to content

Commit

Permalink
Add github action to update parliament data
Browse files Browse the repository at this point in the history
  • Loading branch information
ajparsons committed Feb 12, 2025
1 parent 0e571d8 commit 1c22d98
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Data Updater

on:
schedule:
- cron: '0 22 * * *'
workflow_dispatch:

jobs:
update:
name: Update
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Install poetry
run: pipx install poetry

- uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'poetry'

- name: setup python packages
run: poetry install

- name: Run data update script
run: poetry run script/dataupdate --verbose

- name: Push new data
id: auto-commit-action
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Automatic data update"

- name: Send GitHub Action trigger data to Slack workflow
id: slack
if: steps.auto-commit-action.outputs.changes_detected == 'true'
uses: slackapi/[email protected]
with:
payload: |
{
"repo_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.HAPPY_DATABOT_SLACK_WEBHOOK }}

- name: Send GitHub Action trigger data to Slack workflow (if failed)
if: ${{ failure() }}
id: slack-failed
uses: slackapi/[email protected]
with:
payload: |
{
"repo_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SAD_DATABOT_SLACK_WEBHOOK }}

0 comments on commit 1c22d98

Please sign in to comment.