Compare commits

..
13 Commits
5 changed files with 64 additions and 19 deletions
+21
View File
@@ -1,5 +1,26 @@
# Changelog # Changelog
## [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) ## [1.4.0](https://github.com/SethCohen/github-release-to-discord/compare/v1.3.0...v1.4.0) (2022-08-24)
+28 -15
View File
@@ -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
![output](https://i.imgur.com/fOIu7pC.png)
**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 -1
View File
@@ -27,11 +27,22 @@ 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)
return `**__${newString}__**`
})
.replace(/## (.*?)\n/g,function (substring) {
const newString = substring.slice(3)
return `**${newString}**`
})
.replace(/(\r\n|\n|\r)/gm, "\n")
const embedMsg = { const embedMsg = {
title: `Release ${content.version}`, title: `Release ${content.version}`,
url: content.html_url, url: content.html_url,
color: colour, color: colour,
description: content.body, description: description,
} }
const body = { username: username, avatar_url: avatarUrl, embeds: [embedMsg], } const body = { username: username, avatar_url: avatarUrl, embeds: [embedMsg], }
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "github-release-to-discord", "name": "github-release-to-discord",
"version": "1.4.0", "version": "1.7.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "github-release-to-discord", "name": "github-release-to-discord",
"version": "1.4.0", "version": "1.7.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@actions/core": "^1.9.1", "@actions/core": "^1.9.1",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "github-release-to-discord", "name": "github-release-to-discord",
"version": "1.4.0", "version": "1.7.0",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {