diff --git a/action.yml b/action.yml index 44f371c..3f05b3a 100644 --- a/action.yml +++ b/action.yml @@ -4,6 +4,18 @@ inputs: webhook_url: description: Discord's webhook url. Use GH repo secrets. required: true + colour: + description: Decimal colour value for embed. + required: false + default: '0' + username: + description: String username for webhook. + required: false + default: 'Release Changelog' + avatar_url: + description: String url to webhook avatar picture. + required: false + default: 'https://cdn.discordapp.com/avatars/487431320314576937/bd64361e4ba6313d561d54e78c9e7171.png' runs: using: 'node16' main: 'index.js' \ No newline at end of file diff --git a/index.js b/index.js index 635ea61..721c1df 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,5 @@ const core = require('@actions/core'); const github = require('@actions/github'); - const fetch = require('node-fetch') async function getContext () { @@ -18,6 +17,9 @@ async function getContext () { async function run () { try { const webhookUrl = core.getInput('webhook_url') + const colour = core.getInput('colour') + const username = core.getInput('username') + const avatarUrl = core.getInput('avatar_url') if (!webhookUrl) { return core.setFailed('webhook_url not set. Please set it.') @@ -26,13 +28,13 @@ async function run () { const content = await getContext() const embedMsg = { - color: 3447003, title: `Release ${content.version}`, + url: content.html_url, + color: colour, description: content.body, - url: content.html_url } - const body = { embeds: [embedMsg] } + const body = { username: username, avatar_url: avatarUrl, embeds: [embedMsg], } const url = `${webhookUrl}?wait=true`