-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add github action to update parliament data
- Loading branch information
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
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
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 }} |