mirror of
https://github.com/SethCohen/github-releases-to-discord
synced 2026-09-14 20:13:23 +00:00
feat: updated action
This commit is contained in:
+12
@@ -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'
|
||||
@@ -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`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user