mirror of
https://github.com/SethCohen/github-releases-to-discord
synced 2026-09-14 20:13:23 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8a34e1c2b | ||
|
|
95e1e3916a | ||
|
|
d9fc7b4fe2 | ||
|
|
6cf9efb8f6 | ||
|
|
a85b6a9dbb | ||
|
|
c7879f8c69 | ||
|
|
8cefd5bd3e | ||
|
|
9c4c902465 | ||
|
|
d3640c3c29 | ||
|
|
1f9e824518 | ||
|
|
cc060ff5e6 | ||
|
|
c517936fef | ||
|
|
3bbff89e48 | ||
|
|
4de8705e81 | ||
|
|
a422d74e1a | ||
|
|
7effb69a75 | ||
|
|
65d8ff13e2 | ||
|
|
e114cc793e | ||
|
|
9f49b0c9ab | ||
|
|
1b74a36e5c | ||
|
|
b44c370555 | ||
|
|
a9859d2b26 | ||
|
|
7cc064fafc | ||
|
|
074896c0da | ||
|
|
4517d8d0ec | ||
|
|
ac2e4a38e2 | ||
|
|
41e4a2f6dc | ||
|
|
50fb8302d6 | ||
|
|
222db8282a | ||
|
|
a1d7a74af9 | ||
|
|
79005b23fe | ||
|
|
92a3719c62 | ||
|
|
e246e5daae | ||
|
|
05a8400642 | ||
|
|
b612527333 | ||
|
|
0eef0fe741 | ||
|
|
8b5e4a482d | ||
|
|
4f5dc6e8f6 | ||
|
|
0cea8a493d |
@@ -10,4 +10,5 @@ jobs:
|
|||||||
- uses: google-github-actions/release-please-action@v3
|
- uses: google-github-actions/release-please-action@v3
|
||||||
with:
|
with:
|
||||||
release-type: node
|
release-type: node
|
||||||
package-name: release-please-action
|
package-name: release-please-action
|
||||||
|
token: ${{ secrets.WORKFLOW_TOKEN }}
|
||||||
@@ -1,5 +1,70 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [1.9.0](https://github.com/SethCohen/github-release-to-discord/compare/v1.8.0...v1.9.0) (2022-08-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* updated action description format ([6cf9efb](https://github.com/SethCohen/github-release-to-discord/commit/6cf9efb8f65526de47e335b56163eef55b6b9a1c))
|
||||||
|
|
||||||
|
## [1.8.0](https://github.com/SethCohen/github-release-to-discord/compare/v1.7.0...v1.8.0) (2022-08-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* updated action description format ([9c4c902](https://github.com/SethCohen/github-release-to-discord/commit/9c4c90246562bad1531cf41d44d3c037fbf869ee))
|
||||||
|
|
||||||
|
## [1.7.0](https://github.com/SethCohen/github-release-to-discord/compare/v1.6.0...v1.7.0) (2022-08-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* updated action description format ([c517936](https://github.com/SethCohen/github-release-to-discord/commit/c517936fefb0119c0055d4d537bad23e647edd44))
|
||||||
|
|
||||||
|
## [1.6.0](https://github.com/SethCohen/github-release-to-discord/compare/v1.5.0...v1.6.0) (2022-08-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* updated action description format ([7effb69](https://github.com/SethCohen/github-release-to-discord/commit/7effb69a75fd35dc53ea6dad5f3fa60cbd523ee7))
|
||||||
|
|
||||||
|
## [1.5.0](https://github.com/SethCohen/github-release-to-discord/compare/v1.4.0...v1.5.0) (2022-08-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* updated action description format ([9f49b0c](https://github.com/SethCohen/github-release-to-discord/commit/9f49b0c9ab5de966ccc4af94863fbddd73bac884))
|
||||||
|
|
||||||
|
## [1.4.0](https://github.com/SethCohen/github-release-to-discord/compare/v1.3.0...v1.4.0) (2022-08-24)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* updated action colour ([ac2e4a3](https://github.com/SethCohen/github-release-to-discord/commit/ac2e4a38e2cad7e65dac53a1b4591fd46d65130d))
|
||||||
|
* updated description ([4517d8d](https://github.com/SethCohen/github-release-to-discord/commit/4517d8d0ec09c575248503c50ed25f15677f8f3d))
|
||||||
|
|
||||||
|
## [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)
|
## 1.0.0 (2022-08-24)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,34 @@
|
|||||||
# Hello world javascript action
|
# Github Release To Discord Action
|
||||||
|
|
||||||
This action prints "Hello World" or "Hello" + the name of a person to greet to the log.
|
This action parses a github release and posts it to a discord channel via a discord webhook.
|
||||||
|
## Configuration
|
||||||
|
| Variable | Required | Default | Description |
|
||||||
|
|-------------|----------|----------------------------------------------------------------------------------------------------------------|---------------------------------------------|
|
||||||
|
| webhook_url | ✔ | | Discord's webhook url. Use GH repo secrets. |
|
||||||
|
| colour | ❌ | "2105893" | Decimal colour value for embed. |
|
||||||
|
| username | ❌ | "Release Changelog" | String username for webhook. |
|
||||||
|
| avatar_url | ❌ | ["Profile Picture"](https://cdn.discordapp.com/avatars/487431320314576937/bd64361e4ba6313d561d54e78c9e7171.png) | String url to webhook avatar picture. |
|
||||||
|
|
||||||
## Inputs
|
|
||||||
|
|
||||||
## `who-to-greet`
|
## Output
|
||||||
|

|
||||||
**Required** The name of the person to greet. Default `"World"`.
|
|
||||||
|
|
||||||
## Outputs
|
|
||||||
|
|
||||||
## `time`
|
|
||||||
|
|
||||||
The time we greeted you.
|
|
||||||
|
|
||||||
## Example usage
|
## Example usage
|
||||||
|
|
||||||
uses: actions/hello-world-javascript-action@v1.1
|
```yaml
|
||||||
with:
|
on:
|
||||||
who-to-greet: 'Mona the Octocat'
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
github-release-to-discord:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Handle Release
|
||||||
|
uses: ./ # Uses an action in the root directory
|
||||||
|
id: release
|
||||||
|
with:
|
||||||
|
webhook_url: ${{ secrets.WEBHOOK_URL }}
|
||||||
|
```
|
||||||
+12
@@ -4,6 +4,18 @@ inputs:
|
|||||||
webhook_url:
|
webhook_url:
|
||||||
description: Discord's webhook url. Use GH repo secrets.
|
description: Discord's webhook url. Use GH repo secrets.
|
||||||
required: true
|
required: true
|
||||||
|
colour:
|
||||||
|
description: Decimal colour value for embed.
|
||||||
|
required: false
|
||||||
|
default: '2105893'
|
||||||
|
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:
|
runs:
|
||||||
using: 'node16'
|
using: 'node16'
|
||||||
main: 'index.js'
|
main: 'index.js'
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
const github = require('@actions/github');
|
const github = require('@actions/github');
|
||||||
|
|
||||||
const fetch = require('node-fetch')
|
const fetch = require('node-fetch')
|
||||||
|
|
||||||
async function getContext () {
|
async function getContext () {
|
||||||
@@ -18,6 +17,9 @@ async function getContext () {
|
|||||||
async function run () {
|
async function run () {
|
||||||
try {
|
try {
|
||||||
const webhookUrl = core.getInput('webhook_url')
|
const webhookUrl = core.getInput('webhook_url')
|
||||||
|
const colour = core.getInput('colour')
|
||||||
|
const username = core.getInput('username')
|
||||||
|
const avatarUrl = core.getInput('avatar_url')
|
||||||
|
|
||||||
if (!webhookUrl) {
|
if (!webhookUrl) {
|
||||||
return core.setFailed('webhook_url not set. Please set it.')
|
return core.setFailed('webhook_url not set. Please set it.')
|
||||||
@@ -25,14 +27,25 @@ async function run () {
|
|||||||
|
|
||||||
const content = await getContext()
|
const content = await getContext()
|
||||||
|
|
||||||
|
const description = content.body
|
||||||
|
.replace(/### (.*?)\n/g,function (substring) {
|
||||||
|
const newString = substring.slice(4).replace(/(\r\n|\n|\r)/gm, "")
|
||||||
|
return `**__${newString}__**`
|
||||||
|
})
|
||||||
|
.replace(/## (.*?)\n/g,function (substring) {
|
||||||
|
const newString = substring.slice(3).replace(/(\r\n|\n|\r)/gm, "")
|
||||||
|
return `**${newString}**`
|
||||||
|
})
|
||||||
|
.replace(/\n\s*\n/g, '\n')
|
||||||
|
|
||||||
const embedMsg = {
|
const embedMsg = {
|
||||||
color: 3447003,
|
|
||||||
title: `Release ${content.version}`,
|
title: `Release ${content.version}`,
|
||||||
description: content.body,
|
url: content.html_url,
|
||||||
url: content.html_url
|
color: colour,
|
||||||
|
description: description,
|
||||||
}
|
}
|
||||||
|
|
||||||
const body = { embeds: [embedMsg] }
|
const body = { username: username, avatar_url: avatarUrl, embeds: [embedMsg], }
|
||||||
|
|
||||||
const url = `${webhookUrl}?wait=true`
|
const url = `${webhookUrl}?wait=true`
|
||||||
|
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "github-release-to-discord",
|
"name": "github-release-to-discord",
|
||||||
"version": "1.0.0",
|
"version": "1.9.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "github-release-to-discord",
|
"name": "github-release-to-discord",
|
||||||
"version": "1.0.0",
|
"version": "1.9.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.9.1",
|
"@actions/core": "^1.9.1",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "github-release-to-discord",
|
"name": "github-release-to-discord",
|
||||||
"version": "1.0.0",
|
"version": "1.9.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user