Compare commits

..
13 Commits
6 changed files with 61 additions and 11 deletions
+2 -1
View File
@@ -10,4 +10,5 @@ jobs:
- uses: google-github-actions/release-please-action@v3
with:
release-type: node
package-name: release-please-action
package-name: release-please-action
token: ${{ secrets.WORKFLOW_TOKEN }}
+22
View File
@@ -1,5 +1,27 @@
# Changelog
## [1.3.0](https://github.com/SethCohen/github-release-to-discord/compare/v1.2.0...v1.3.0) (2022-08-24)
### Features
* changed default action colour ([79005b2](https://github.com/SethCohen/github-release-to-discord/commit/79005b23fefce850957d37ba17ebb796dc81f6a1))
* updated description format ([a1d7a74](https://github.com/SethCohen/github-release-to-discord/commit/a1d7a74af90fcf8c00d341c8c665ca796b18c689))
## [1.2.0](https://github.com/SethCohen/github-release-to-discord/compare/v1.1.0...v1.2.0) (2022-08-24)
### Features
* updated action ([b612527](https://github.com/SethCohen/github-release-to-discord/commit/b6125273330075a9f4de3e58f2fc7f52d85d4691))
## [1.1.0](https://github.com/SethCohen/github-release-to-discord/compare/v1.0.0...v1.1.0) (2022-08-24)
### Features
* updated release-please ([0cea8a4](https://github.com/SethCohen/github-release-to-discord/commit/0cea8a493d5e12b1dc7414ecbed678f4671dda37))
## 1.0.0 (2022-08-24)
+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: '202225'
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'
+22 -7
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.')
@@ -25,14 +27,27 @@ async function run () {
const content = await getContext()
const embedMsg = {
color: 3447003,
title: `Release ${content.version}`,
description: content.body,
url: content.html_url
let description = '';
for (const line of content.body) {
if (line.startsWith('## ')) {
description += `**${line.slice(3)}**\n`;
}
else if (line.startsWith('### ')) {
description += `**__${line.slice(4)}__**\n`;
}
else if (line.startsWith('* ')) {
description += `- ${line.slice(2)}\n`;
}
}
const body = { embeds: [embedMsg] }
const embedMsg = {
title: `Release ${content.version}`,
url: content.html_url,
color: colour,
description: description,
}
const body = { username: username, avatar_url: avatarUrl, embeds: [embedMsg], }
const url = `${webhookUrl}?wait=true`
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "github-release-to-discord",
"version": "1.0.0",
"version": "1.3.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "github-release-to-discord",
"version": "1.0.0",
"version": "1.3.0",
"license": "ISC",
"dependencies": {
"@actions/core": "^1.9.1",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "github-release-to-discord",
"version": "1.0.0",
"version": "1.3.0",
"description": "",
"main": "index.js",
"scripts": {