-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (61 loc) · 1.77 KB
/
notify.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
name: Notify
on:
workflow_call:
inputs:
cache_key:
required: true
type: string
slack_channel_id:
required: true
type: string
group_name:
required: false
type: string
secrets:
SEARCH_PARAMS:
required: false
HYPOTHESIS_API_TOKEN:
required: false
SLACK_BOT_TOKEN:
required: true
jobs:
Notify:
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v4
with:
key: cache-${{ inputs.cache_key }}-${{ github.run_number }}
path: ~/.cache.json
restore-keys: |
cache-${{ inputs.cache_key }}-
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: 3.13
- name: Install pipx
run: python -m pip install pipx
- name: Checkout slack-annotations
uses: actions/checkout@v4
- name: Install slack-annotations
run: python -m pipx install .
- name: Check for annotations
id: slack_message
run: |
{
echo 'SLACK_MESSAGE<<EOF'
slack-annotations \
--search-params '${{ secrets.SEARCH_PARAMS }}' \
--token '${{ secrets.HYPOTHESIS_API_TOKEN }}' \
--cache-path ~/.cache.json \
--group-name '${{ inputs.GROUP_NAME }}'
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Post to Slack
uses: slackapi/[email protected]
with:
channel-id: ${{ inputs.slack_channel_id }}
payload: ${{ env.SLACK_MESSAGE }}
env:
SLACK_MESSAGE: ${{ steps.slack_message.outputs.SLACK_MESSAGE }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
if: steps.slack_message.outputs.SLACK_MESSAGE