1
- # Discord Webhook
1
+ # Discord Workflow Status Notifier
2
2
3
- A GitHub Action to call a Discord Webhook
3
+ A GitHub action to report workflow and job status to a Discord Webhook
4
4
5
5
## Inputs
6
6
@@ -20,31 +20,69 @@ A GitHub Action to call a Discord Webhook
20
20
Use the defaults
21
21
22
22
``` yaml
23
- - name : Notify
24
- uses : nobrayner/discord-webhook@v1
25
- with :
26
- github-token : ${{ secrets.GITHUB_TOKEN }}
27
- discord-webhook : ${{ secrets.DISCORD_WEBHOOK }}
23
+ name : Build and Test
24
+ on : [ pull_request ]
25
+
26
+ jobs :
27
+ build :
28
+ name : Build the Code
29
+ # build job
30
+ test :
31
+ name : Test the Code
32
+ # test job
33
+ notify :
34
+ name : Discord Notification
35
+ runs-on : ubuntu-latest
36
+ needs : # make sure the notification is sent AFTER the jobs you want included have completed
37
+ - build
38
+ - test
39
+ if : ${{ always() }} # You always want to be notified: success, failure, or cancelled
40
+
41
+ steps :
42
+ - name : Notify
43
+ uses : nobrayner/discord-webhook@v1
44
+ with :
45
+ github-token : ${{ secrets.github_token }}
46
+ discord-webhook : ${{ secrets.DISCORD_WEBHOOK }}
28
47
` ` `
29
48
30
49

31
50
32
51
Overwrite everything
33
52
34
53
` ` ` yaml
35
- - name : Notify
36
- uses : nobrayner/discord-webhook@v1
37
- with :
38
- github-token : ${{ secrets.GITHUB_TOKEN }}
39
- discord-webhook : ${{ secrets.DISCORD_WEBHOOK }}
40
- username : ' Bob'
41
- avatar-url : ' https://octodex.github.com/images/Terracottocat_Single.png'
42
- title : ' ${{ github.workflow }}: {{STATUS}}'
43
- description : ' ${{ github.event_name }} trigged this {{STATUS}}!'
44
- include-details : ' false'
45
- color-success : ' #4287f5'
46
- color-failure : ' eb4034'
47
- color-cancelled : ' 0x42daf5'
54
+ name : Build and Test
55
+ on : [ pull_request ]
56
+
57
+ jobs :
58
+ build :
59
+ name : Build the Code
60
+ # build job
61
+ test :
62
+ name : Test the Code
63
+ # test job
64
+ notify :
65
+ name : Discord Notification
66
+ runs-on : ubuntu-latest
67
+ needs : # make sure the notification is sent AFTER the jobs you want included have completed
68
+ - build
69
+ - test
70
+ if : ${{ always() }} # You always want to be notified: success, failure, or cancelled
71
+
72
+ steps :
73
+ - name : Notify
74
+ uses : nobrayner/discord-webhook@v1
75
+ with :
76
+ github-token : ${{ secrets.GITHUB_TOKEN }}
77
+ discord-webhook : ${{ secrets.DISCORD_WEBHOOK }}
78
+ username : ' Bob'
79
+ avatar-url : ' https://octodex.github.com/images/Terracottocat_Single.png'
80
+ title : ' ${{ github.workflow }}: {{STATUS}}'
81
+ description : ' ${{ github.event_name }} trigged this {{STATUS}}!'
82
+ include-details : ' false'
83
+ color-success : ' #4287f5'
84
+ color-failure : ' eb4034'
85
+ color-cancelled : ' 0x42daf5'
48
86
` ` `
49
87
50
88

0 commit comments