A GitHub Action to send Discord webhook.
Important
- This documentation is v7.0.0 based; To view other version's documentation, please visit the versions list and select the correct version.
- Support attachments/files.
- Support poll.
- Support thread.
GitHub | |
---|---|
GitHub Actions Runner | ✔️ Docker |
Note
- It is possible to use this action in other methods/ways which not listed in here, however those methods/ways are not officially supported, and should beware maybe cause security issues.
- GitHub:
hugoalh/send-discord-webhook-ghaction[@{Tag}]
Note
- It is recommended to use this action with tag for immutability.
This action does not request any GitHub token permission.
Almost all of the inputs are optional, but these groups of inputs must be defined:
key
- One of:
content
,embeds
, and/orfiles
poll_question
andpoll_answers
- One of:
- None
thread_id
thread_name
and optionalthread_tags
Legend Description 🔐 Should be an encrypted secret.
🔐 <string>
Discord webhook key; These syntaxes are acceptable:
- Webhook ID & Token:
{webhook.id}/{webhook.token}
- URL:
https://discord.com/api/webhooks/{webhook.id}/{webhook.token}
- URL (Legacy):
https://discordapp.com/api/webhooks/{webhook.id}/{webhook.token}
<string>
Override the default webhook username, maximum 80 characters; "Clyde" is not allowed.
<string>
Override the default webhook avatar, only support URL of HTTP and HTTPS.
<string>
Message content, maximum 2000 characters; Support Discord Markdown.
<RegExp[]>
Links' regular expressions to prevent Discord resolve and display matches links in the content
as embed under the message, only support URL of HTTP and HTTPS, separate each value per line.
Examples:
- All:
.+
.png
Image:\.png(?:\?|#|$)
.webp
Image:\.webp(?:\?|#|$)
- Twitch:
twitch\.tv
<object[]>
Message embed rich content, by JSON or YAML with restricted syntaxes, maximum 10 embeds, and maximum 6000 characters for summation from inputs:
embeds[*].title
embeds[*].description
embeds[*].footer.text
embeds[*].author.name
embeds[*].fields[*].name
embeds[*].fields[*].value
<string>
Message embed title, maximum 256 characters; Support Discord Markdown.
<string>
Message embed description, maximum 4096 characters; Support Discord Markdown.
<string>
Message embed URL.
<string>
Message embed timestamp, by ISO 8601 format (e.g.: "2011-11-11T11:11:11Z"
).
<number | string = 2105893>
Message embed colour (i.e.: left border's colour of the embed); These syntaxes are acceptable:
- RGB Integer:
{number}
(e.g.:2105893
) - Hex:
#{hex}{hex}{hex}
/#{hex}{hex}{hex}{hex}{hex}{hex}
(e.g.:#0063B1
) - Namespace: (e.g.:
Blue
) - CSS: (e.g.:
rgb(32, 34, 37)
) - Random:
Random
- Special:
-
Discord Embed Default
/#202225
/rgb(32, 34, 37)
-
Discord Embed Background Dark
/#2F3136
/rgb(47, 49, 54)
-
Discord Blurple
/#5865F2
/rgb(88, 101, 242)
-
Discord Fuchsia
/#EB459E
/rgb(254, 231, 92)
-
Discord Green
/#57F287
/rgb(87, 242, 135)
-
Discord Red
/#ED4245
/rgb(237, 66, 69)
-
Discord Yellow
/#FEE75C
/rgb(254, 231, 92)
-
Note
- Alpha channel is not supported.
- General namespace are provided by NPM package
color-name-list
, list maybe change or remove without any notification, it is recommended to use value instead.
<object>
Message embed footer.
<string>
Message embed footer text, maximum 2048 characters; Support Discord Markdown.
<string>
Message embed footer icon, only support URL of HTTP, HTTPS, and attachments.
<object>
Message embed image.
<string>
Message embed image URL, only support URL of HTTP, HTTPS, and attachments.
<object>
Message embed thumbnail.
<string>
Message embed thumbnail URL, only support URL of HTTP, HTTPS, and attachments.
<object>
Message embed author.
<string>
Message embed author name, maximum 256 characters.
<string>
Message embed author URL.
<string>
Message embed author icon, only support URL of HTTP, HTTPS, and attachments.
<object[]>
Message embed fields, maximum 25 fields.
<string>
Message embed field name, maximum 256 characters; Support Discord Markdown.
<string>
Message embed field value, maximum 1024 characters; Support Discord Markdown.
<boolean = false>
Whether the message embed field should display inline.
<string>
Message poll question, maximum 300 characters.
<object[]>
Message poll answers, by JSON or YAML with restricted syntaxes, maximum 10 answers, and maximum 55 characters per answer text.
Poll answer can either text only, or append emoji with either custom emoji (id
) or default emoji (name
).
Example:
- emoji: # Default
name: "🐈"
text: "Cat"
- emoji: # Default
name: "🐕"
text: "Dog"
- emoji: # Custom
id: "1"
text: "Me"
- text: "Other"
<number = 24>
Message poll duration, by hours, maximum 32 days (i.e.: 768 hours).
<boolean = false>
Whether the message poll allow multiple select answers.
<string[]>
Message attachments/files, by Glob path or literal path (select by input files_glob
) under the workspace, separate each value per line, maximum 8 MB and 10 files.
<boolean = true>
Whether input files should accept Glob path instead of literal path.
<boolean = true>
Whether the message allowed @everyone
and @here
mentions.
<boolean = true>
Whether the message allowed roles mentions.
<boolean = true>
Whether the message allowed users mentions.
<string[]>
Message allowed mention roles, by role ID, separate each value with comma (,
) or per line, maximum 100 roles.
<string[]>
Message allowed mention users, by user ID, separate each value with comma (,
) or per line, maximum 100 users.
<boolean = false>
Whether the message use TTS (Text To Speech).
<string>
Message channel thread ID. When this input is defined, the message will send to the specify thread, the thread will automatically unarchive.
<string>
Forum channel thread name, maximum 100 characters. When this input is defined, the message will create a new thread with the name.
<string[]>
Forum channel thread tags, by thread tag ID, separate each value with comma (,
) or per line, maximum 5 tags.
<boolean = true>
Whether the message trigger push and desktop notifications.
<boolean = true>
Whether to try truncate firstly when inputs are too large. Truncate will not work on inputs:
<string = "...">
Ellipsis mark.
<string = "end">
Ellipsis position.
"end"
: At the end of the string."middle"
: At the middle of the string."start"
: At the start of the string.
<boolean = true>
Whether to wait for Discord confirmation of message send before response, and returns the created message body. When this input is false
, a message that is not saved does not return an error.
<string>
Response content.
<number>
Request status code.
<boolean>
Whether the request was successful.
<string>
Request status text.
- Hello, world!
jobs: job_id: name: "Send Discord Webhook" runs-on: "ubuntu-latest" steps: - uses: "hugoalh/send-discord-webhook-ghaction@v7.0.0" with: key: "${{secrets.DISCORD_WEBHOOK_KEY}}" content: "Hello, world!"
- birdie0 (from birdie0's Discord Webhooks Guide)
jobs: job_id: name: "Send Discord Webhook" runs-on: "ubuntu-latest" steps: - uses: "hugoalh/send-discord-webhook-ghaction@v7.0.0" with: key: "${{secrets.DISCORD_WEBHOOK_KEY}}" username: "Webhook" avatar_url: "https://i.imgur.com/4M34hi2.png" content: "Text message. Up to 2000 characters." embeds: | [ { "author": { "name": "Birdie♫", "url": "https://www.reddit.com/r/cats/", "icon_url": "https://i.imgur.com/R66g1Pe.jpg" }, "title": "Title", "url": "https://google.com/", "description": "Text message. You can use Markdown here. *Italic* **bold** __underline__ ~~strikeout~~ [hyperlink](https://google.com) `code`", "color": 15258703, "fields": [ { "name": "Text", "value": "More text", "inline": true }, { "name": "Even more text", "value": "Yup", "inline": true }, { "name": "Use `\"inline\": true` parameter, if you want to display fields in the same line.", "value": "okay..." }, { "name": "Thanks!", "value": "You're welcome :wink:" } ], "thumbnail": { "url": "https://upload.wikimedia.org/wikipedia/commons/3/38/4-Nature-Wallpapers-2014-1_ukaavUI.jpg" }, "image": { "url": "https://upload.wikimedia.org/wikipedia/commons/5/5a/A_picture_from_China_every_day_108.jpg" }, "footer": { "text": "Woah! So cool! :smirk:", "icon_url": "https://i.imgur.com/fKL31aD.jpg" } } ]
- Discord
- GitHub Actions