GitHub Action
Send Discord Webhook
A GitHub Action to send Discord webhook.
Important
This documentation is v6.0.0 based; To view other version's documentation, please visit the versions list and select the correct version.
- Support attachments/files.
- Support thread.
💽 Softwares
- NodeJS ^ v20.9.0
Note
It is possible to use this action in other methods/ways which not listed in here, however it is not officially supported.
- GitHub:
hugoalh/send-discord-webhook-ghaction
Note
It is recommended to use this action with tag for immutability.
This action does not require any permission.
Legend Description 🔐 Should be an encrypted secret.
🔐 <string>
Key; Both long and short forms are acceptable.
https://discord.com/api/webhooks/70971114/ueyzeWxB_8bb1zMhL ⬅Long
^^^^^^^^^^^^^^^^^^^^^^^^^^ ⬅Short
https://discordapp.com/api/webhooks/70971114/ueyzeWxB_8bb1zMhL ⬅Long (Legacy)
^^^^^^^^^^^^^^^^^^^^^^^^^^ ⬅Short (Legacy)
[Optional] <string>
Content of the message, up to 2000 characters; Support Discord Markdown.
[Optional] <RegExp[]>
Specify links in the content
to prevent Discord resolve and display as embed under the message, only supports HTTP and HTTPS, separate each value per line.
- All:
.+
.png
Image:\.png(?:\?|#|$)
.webp
Image:\.webp(?:\?|#|$)
- Twitch:
twitch\.tv
[Optional] <string>
Override the default username of the webhook, up to 80 characters; "Clyde" is not allowed.
[Optional] <string>
Override the default avatar of the webhook with source URL, only supports HTTP and HTTPS.
[Optional] <boolean = false>
Whether to use TTS (Text To Speech) for the message.
[Optional] <object[]>
Embed rich content for the message, by JSON or YAML with restricted format and pattern, up to 10 embeds and 6000 characters for summation from inputs:
embeds[*].title
embeds[*].description
embeds[*].footer.text
embeds[*].author.name
embeds[*].fields[*].name
embeds[*].fields[*].value
[Optional] <string>
Title of the embed, up to 256 characters; Support Discord Markdown.
[Optional] <string>
Description of the embed, up to 4096 characters; Support Discord Markdown.
[Optional] <string>
URL of the embed.
[Optional] <string>
Timestamp of the embed, by ISO 8601 format (e.g.: "2011-11-11T11:11:11Z"
).
[Optional] <number | string = 2105893>
Color of the embed (i.e.: left border's color of the embed); RGB integer, Hex (with prefix #
(sharp)), namespace, and CSS colors (e.g.: "rgb(32, 34, 37)"
) forms are acceptable.
Exclusive namespace:
Important
- Alpha channel is not supported.
- General namespace are provided by
meodai/color-names
, maybe change and/or remove without any notification, it is recommended to use value instead except you want a random color.
[Optional] <object>
Footer of the embed.
[Optional] <string>
Footer text, up to 2048 characters; Support Discord Markdown.
[Optional] <string>
Source URL of the footer icon, only supports HTTP, HTTPS, and attachments.
[Optional] <object>
Image of the embed.
[Optional] <string>
Source URL of the image, only supports HTTP, HTTPS, and attachments.
[Optional] <object>
Thumbnail of the embed.
[Optional] <string>
Source URL of the thumbnail, only supports HTTP, HTTPS, and attachments.
[Optional] <object>
Author of the embed.
[Optional] <string>
Author name, up to 256 characters.
[Optional] <string>
Author URL.
[Optional] <string>
Source URL of the author icon, only supports HTTP, HTTPS, and attachments.
[Optional] <object[]>
Fields of the embed, up to 25 fields.
[Optional] <string>
Field name, up to 256 characters; Support Discord Markdown.
[Optional] <string>
Field value, up to 1024 characters; Support Discord Markdown.
[Optional] <boolean = false>
Whether the field should display inline.
[Optional] <string[] = "roles,users,everyone">
Allowed mention types to parse from the content, separate each value with comma (,
), vertical bar (|
), semi-colon (;
), whitespace, or per line.
"roles"
: Control roles mentions."users"
: Control users mentions."everyone"
: Control@everyone
and@here
mentions.
[Optional] <string[]>
Allowed roles' IDs to mention, separate each value with comma (,
), vertical bar (|
), semi-colon (;
), whitespace, or per line, up to 100 IDs.
[Optional] <string[]>
Allowed users' IDs to mention, separate each value with comma (,
), vertical bar (|
), semi-colon (;
), whitespace, or per line, up to 100 IDs.
[Optional] <string[]>
Files as attachments of the message, separate each value per line, up to 8 MB and 10 files.
[Optional] <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.
[Optional] <string>
Thread ID for the message channel. When this input is defined, the message will send to the specify thread, the thread will automatically unarchive.
Important
Only either inputs of thread_id
or thread_name
can be provided.
[Optional] <string>
Thread name for the forum channel, up to 100 characters. When this input is defined, the message will create a new thread with the name.
Important
Only either inputs of thread_id
or thread_name
can be provided.
[Optional] <boolean = true>
Whether to try truncate firstly when inputs are too large.
[Optional] <string = "...">
Ellipsis mark.
[Optional] <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.
<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@v6.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@v6.0.0" with: key: "${{secrets.DISCORD_WEBHOOK_KEY}}" content: "Text message. Up to 2000 characters." username: "Webhook" avatar_url: "https://i.imgur.com/4M34hi2.png" 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