-
Notifications
You must be signed in to change notification settings - Fork 11
59 lines (55 loc) · 1.72 KB
/
slack.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
name: Slack
on:
push:
branches:
- slack
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
pull-requests: write
steps:
- name: Get package information
id: package_info
run: |
CHANGES='[{"name": "@xx/xx", "version": "1.2.0"}, {"name": "@xx/xy", "version": "0.8.9"}]'
echo "::set-output name=changes::$CHANGES"
- name: Send custom JSON data to Slack workflow
id: slack
uses: slackapi/[email protected]
with:
# This data can be any valid JSON from a previous step in the GitHub Action
payload: |
{
"text": "🎉 New releases available:",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "🎉 New releases available:"
}
},
{{#each (fromJSON(steps.package_info.outputs.changes)) as |package|}}
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Package Name:*\n${{ package.name }}"
},
{
"type": "mrkdwn",
"text": "*Version:*\n${{ package.version }}"
}
]
},
{{/each}}
]
}
env:
SLACK_WEBHOOK_URL: "https://hooks.slack.com/services/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"