feat: updated action

This commit is contained in:
SethCohen
2022-08-23 23:19:34 -04:00
parent 4f5dc6e8f6
commit b612527333
2 changed files with 18 additions and 4 deletions
+12
View File
@@ -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'
+6 -4
View File
@@ -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`