File tree Expand file tree Collapse file tree 2 files changed +54
-4
lines changed Expand file tree Collapse file tree 2 files changed +54
-4
lines changed Original file line number Diff line number Diff line change
1
+ name : slack-alert-action
2
+ description : " Action to send slack payload to public-sdk-events channel"
3
+
4
+ inputs :
5
+ heading_text :
6
+ required : true
7
+ alert_type :
8
+ required : true
9
+
10
+ runs :
11
+ using : " composite"
12
+
13
+ steps :
14
+ - name : Send slack notification
15
+ id : slack
16
+ uses : slackapi/slack-github-action@v1.27.0
17
+ env :
18
+ SLACK_WEBHOOK_URL : " "
19
+ with :
20
+ payload : |
21
+ {
22
+ "channel": "#public-sdk-events",
23
+ "text": ${{inputs.heading_text}}
24
+ "attachments": [
25
+ {
26
+ "color": ${{inputs.alert_type}},
27
+ "fields": [
28
+ {
29
+ "title": "Repository",
30
+ "value": "${{github.repository}}"
31
+ "short": true
32
+ },
33
+ {
34
+ "title": "Job",
35
+ "value": ""
36
+ "short": true
37
+ },
38
+ {
39
+ "title": "commit",
40
+ "value": "${{github.sha}}"
41
+ "short": true
42
+ },
43
+ ]
44
+ }
45
+ ]
46
+ }
Original file line number Diff line number Diff line change @@ -38,14 +38,18 @@ jobs:
38
38
run : npm publish
39
39
working-directory : xero-node
40
40
41
- notify-slack :
41
+ notify-slack-on-success :
42
42
runs-on : ubuntu-latest
43
43
needs : publish
44
+ if : success()
44
45
steps :
45
- - name : Send slack notification on sucess
46
- if : success()
46
+ - name : Send slack notification on success
47
47
run : echo "Slack alert on success"
48
48
49
+ notify-slack-on-failure :
50
+ runs-on : ubuntu-latest
51
+ needs : publish
52
+ if : failure()
53
+ steps :
49
54
- name : Send slack notification on failure
50
- if : failure()
51
55
run : echo "Slack alert on failure"
You can’t perform that action at this time.
0 commit comments