File tree 2 files changed +15
-4
lines changed
2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -29,19 +29,23 @@ inputs:
29
29
message-context :
30
30
description : extra context information to be included with the notification message, usually displayed below the message
31
31
required : true
32
- default : ' '
32
+ default : " "
33
33
markdown :
34
34
description : whether the message and message-context are in Slack’s Markdown format or not ("true" or "false" as string)
35
35
required : true
36
- default : ' true'
36
+ default : " true"
37
37
replace-timestamp :
38
38
description : the timestamp of a previously-sent message (e.g. from a previous step) to replace with this message
39
39
required : true
40
- default : ' '
40
+ default : " "
41
41
timeout :
42
42
description : " how long to wait before giving up when sending notification to Slack (format: Go time.Duration)"
43
43
required : true
44
44
default : " 30s"
45
+ ignore-failure :
46
+ description : " when true, the action will return success anyway upon failure to notify Slack"
47
+ required : false
48
+ default : " false"
45
49
outputs :
46
50
channel-id :
47
51
description : the canonical channel ID where the message was sent
Original file line number Diff line number Diff line change @@ -49,6 +49,9 @@ func main() {
49
49
githubactions .Fatalf ("timeout: time.ParseDuration: %s\n " , err )
50
50
}
51
51
52
+ ignoreFailureString := githubactions .GetInput ("ignore-failure" )
53
+ ignoreFailure := ignoreFailureString == "true"
54
+
52
55
notifier := & slacknotifier.Notifier {
53
56
BotUsername : botUsername ,
54
57
BotIconEmoji : botIconEmoji ,
@@ -66,7 +69,11 @@ func main() {
66
69
TimestampOfMessageToReplace : replaceMsgTimestamp ,
67
70
})
68
71
if err != nil {
69
- githubactions .Fatalf ("notifer.Notify: %s\n " , err )
72
+ if ignoreFailure {
73
+ githubactions .Warningf ("notifer.Notify: ignored error: %s\n " , err )
74
+ } else {
75
+ githubactions .Fatalf ("notifer.Notify: fatal: %s\n " , err )
76
+ }
70
77
}
71
78
72
79
githubactions .SetOutput ("channel-id" , output .ChannelID )
You can’t perform that action at this time.
0 commit comments