-
Notifications
You must be signed in to change notification settings - Fork 22
70 lines (60 loc) · 1.93 KB
/
update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Data Updater
on:
schedule:
- cron: '13 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
id: update
run: |
output=$(poetry run scripts/dataupdate --verbose)
output=$(echo "$output" | jq -sR .)
echo "update_output<<EOF" >> "$GITHUB_OUTPUT"
echo "$output" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- 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 }}",
"status": "success",
"content": ${{ steps.update.outputs.update_output }}
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.PARLPARSE_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 }}",
"status": "failed",
"content": ${{ steps.update.outputs.update_output }}
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.PARLPARSE_SLACK_WEBHOOK }}