GitHub Action
Send Discord Webhook
SendDiscordWebhook.GitHubAction
Releases | Latest () | Pre () |
---|---|---|
A GitHub Action to send a Discord webhook.
- Support attachments/files.
- Support thread.
⚠ Important: This documentation is v5.0.0 based; To view other version's documentation, please visit the versions list and select the correct version.
- GitHub Actions Runner >= v2.297.0
- NodeJS ^ v16.13.0
jobs:
job_id:
runs-on: "________" # Any
steps:
- uses: "hugoalh/send-discord-webhook-ghaction@<Version>"
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>
Method to send.
- Default: Let this action automatically determine the best method.
"form"
: Usemultipart/form-data
."json"
: Useapplication/json
.
When this input is not defined, and input files
is:
- defined, will use
"form"
. - not defined, will use
"json"
.
When this input is "json"
, and input files
is defined, will throw an error.
[Optional] <object = {}>
JSON/YAML/YML payload, which restricted format and pattern; At least one of the input payload.content
, payload.embeds
, or files
must be provided. View the JSON payload template in here.
⚠ Important: Properties which have not listed in here or in the template are not supported.
[Optional] <string>
Content of the message, up to 2000 characters.
[Optional] <string>
Override the default username of the webhook, up to 80 characters; "Clyde" is not allowed.
[Optional] <string>
Source URL of the avatar, only supports HTTP and HTTPS; Override the default avatar of the webhook.
[Optional] <boolean = false>
Whether to use TTS (Text To Speech) for the message.
[Optional] <object[]>
Embed rich content for the message, up to 10 embeds and 6000 characters for summation of:
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.
[Optional] <string>
Description of the embed, up to 4096 characters.
[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)), namespaced string, and CSS colors string (e.g.: "rgb(32, 34, 37)"
) forms are acceptable. Exclusive namespaced strings:
💡 Hint:
- Alpha channel is not supported.
- Namespaced strings are provided by
meodai/color-names
, maybe change and/or remove without any notification, use value instead except you want a random color.
[Optional] <object>
Footer of the embed.
[Optional] <string>
Footer text, up to 2048 characters.
[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.
[Optional] <string>
Field value, up to 1024 characters.
[Optional] <boolean = false>
Whether the field should display inline.
[Optional] <object>
Allowed mentions for the message.
[Optional] <string[]>
Allowed mention types to parse from the content.
"roles"
: Control roles mentions."users"
: Control users mentions."everyone"
: Control@everyone
and@here
mentions.
[Optional] <string[]>
Allowed roles' IDs to mention, up to 100 IDs.
[Optional] <string[]>
Allowed users' IDs to mention, up to 100 IDs.
[Optional] <string[] = []>
Files as attachments of the message, which must be relative paths from GitHub Actions workspace, up to 8 MB and 10 files; At least one of the input payload.content
, payload.embeds
, or files
must be provided.
[Optional] <boolean = false>
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 = "none">
Thread type of the message; Send to the specified thread within a webhook's channel.
"none"
: Not a thread. When this is defined, will ignore inputthread_value
."id"
: A created thread for message channel, the thread will automatically unarchive. When this is defined, inputthread_value
is require."name"
: A new thread for forum channel.
🔐 [Optional] <string>
Thread value of the message. When thread_type
is:
"none"
, this is ignored."id"
, this is require the created thread ID."name"
, this is the new thread name (i.e.: thread title), up to 100 characters; When not defined, the value will fill with the first available value in this order:payload.content
payload.embeds[0].title
whenpayload.embeds
has only 1 elementpayload.embeds[0].description
whenpayload.embeds
has only 1 elementSend Discord Webhook - {Timestamp}
,Timestamp
is the current time in ISO 8601 format.
[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.
jobs:
job_id:
name: "Send Discord Webhook"
runs-on: "ubuntu-latest"
steps:
- uses: "hugoalh/send-discord-webhook-ghaction@v5.0.0"
with:
key: "${{secrets.DISCORD_WEBHOOK_KEY}}"
payload: |
content: "Hello, world!"
jobs:
job_id:
name: "Send Discord Webhook"
runs-on: "ubuntu-latest"
steps:
- uses: "hugoalh/send-discord-webhook-ghaction@v5.0.0"
with:
key: "${{secrets.DISCORD_WEBHOOK_KEY}}"
payload: |
{
"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"
}
}
]
}