Skip to content

Commit 1766a33

Browse files
committed
Merge branch 'master' into releases/v1
2 parents 16ffbe2 + ad2a613 commit 1766a33

File tree

2 files changed

+65
-23
lines changed

2 files changed

+65
-23
lines changed

README.md

Lines changed: 58 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Discord Webhook
1+
# Discord Workflow Status Notifier
22

3-
A GitHub Action to call a Discord Webhook
3+
A GitHub action to report workflow and job status to a Discord Webhook
44

55
## Inputs
66

@@ -20,31 +20,69 @@ A GitHub Action to call a Discord Webhook
2020
Use the defaults
2121

2222
```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 }}
2847
```
2948
3049
![defaults](https://raw.githubusercontent.com/nobrayner/discord-webhook/master/docs/defaults.png?raw=true)
3150
3251
Overwrite everything
3352
3453
```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'
4886
```
4987
5088
![overwrite-everything](https://raw.githubusercontent.com/nobrayner/discord-webhook/master/docs/overwrite-everything.png?raw=true)

action.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name: 'Discord Webhook'
2-
description: 'A GitHub action to call a Discord Webhook'
1+
name: 'Discord Workflow Status Notifier'
2+
description: 'A GitHub action to report workflow and job status to a Discord Webhook'
33
author: 'Braydon Hall'
44

55
inputs:
@@ -51,4 +51,8 @@ inputs:
5151

5252
runs:
5353
using: 'node12'
54-
main: 'dist/index.js'
54+
main: 'dist/index.js'
55+
56+
branding:
57+
icon: 'message-square'
58+
color: 'gray-dark'

0 commit comments

Comments
 (0)