SendDiscordWebhook.GitHubAction
Release | Latest () | Pre () |
---|---|---|
GitHub |
A GitHub Action to send a Discord webhook.
Previous named "[GitHub Action] Send To Discord".
- Support attachments/files.
- Support thread.
β Important: This documentation is v4.0.0 based; To view other tag's/version's documentation, please visit the tag/version list and select the correct tag/version.
β Important: This entrypoint is currently based to Docker (
+docker
), base can be changed between versions without announcement to ensure the stability.
jobs:
job_id:
runs-on: # Depend on the base requirement, recommended "ubuntu-________"
steps:
- uses: "hugoalh/send-discord-webhook-ghaction@<tag/version>"
Depend on the base requirement.
jobs:
job_id:
runs-on: "ubuntu-________"
steps:
- uses: "hugoalh/send-discord-webhook-ghaction/use-docker@<tag/version>"
- Docker
β Important: This entrypoint maybe need extra steps to manually setup NodeJS version.
jobs:
job_id:
runs-on: *any*
steps:
- uses: "hugoalh/send-discord-webhook-ghaction/use-nodejs@<tag/version>"
- NodeJS (>= v14.15.0) + NPM (>= v6.14.8)
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 (Old)
^^^^^^^^^^^^^^^^^^^^^^^^^^ Short (Old)
[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 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>
The message contents, up to 2000 characters.
[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.
[Optional] <boolean = false>
Use TTS (Text To Speech).
[Optional] <object[]>
Embed rich content, up to 10 embeds, and up to 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 embed, up to 256 characters.
[Optional] <string>
Description of embed, up to 4096 characters.
[Optional] <string>
URL of embed.
[Optional] <string>
Timestamp of embed, with format ISO 8601 (e.g.: "2011-11-11T11:11:11Z"
).
[Optional] <(number | string) = 2105893>
Color of the embed (i.e.: left border's color of embed); Decimal (integer / RGB integer), Hex (6 digits, with prefix #
(sharp)), namespaced string, and RGB string (split with ,
(comma)) forms are acceptable.
[Optional] <object>
Footer of embed.
[Optional] <string>
Footer text, up to 2048 characters.
[Optional] <string>
URL of footer icon, only supports HTTP, HTTPS, and attachments.
[Optional] <object>
Image of embed.
[Optional] <string>
Source URL of image, only supports HTTP, HTTPS, and attachments.
[Optional] <object>
Thumbnail of embed.
[Optional] <string>
Source URL of thumbnail, only supports HTTP, HTTPS, and attachments.
[Optional] <object>
Author of embed.
[Optional] <string>
Name of author, up to 256 characters.
[Optional] <string>
URL of author.
[Optional] <string>
URL of author icon, only supports HTTP, HTTPS, and attachments.
[Optional] <object[]>
Fields of embed, up to 25 fields.
[Optional] <string>
Name of field, up to 256 characters.
[Optional] <string>
Value of field, up to 1024 characters.
[Optional] <boolean = false>
Field should display inline or not.
[Optional] <object>
Allowed mentions for the message.
[Optional] <string[]>
Allowed mention types to parse from the content.
"roles"
: Controls role mentions."users"
: Controls user mentions."everyone"
: Controls@everyone
and@here
mentions.
[Optional] <string[]>
Roles ID to mention, up to 100 IDs.
[Optional] <string[]>
Users ID to mention, up to 100 IDs.
[Optional] <string[] = []>
Files as attachment, which must be relative paths from and inside GitHub Actions workspace, up to 8 MB; At least one of the input payload.content
, payload.embeds
, or files
must be provided.
π [Optional] <string>
Thread ID; Send to the specified thread within a webhook's channel, the thread will automatically be unarchived.
[Optional] <boolean = false>
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] <boolean = true>
When input payload
is too large, try to prune/trim/truncate first.
[Optional] <string = "...">
Ellipsis.
[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.
[Optional] <boolean = false>
Dry run; For debug use.
N/A
jobs:
job_id:
name: "Send Discord Webhook"
runs-on: "ubuntu-latest"
steps:
- uses: "hugoalh/send-discord-webhook-ghaction@v4.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@v4.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"
}
}
]
}