From 9fe781fdc77063b0baff0d6caae0cd2e316f64a8 Mon Sep 17 00:00:00 2001 From: meatvegsandwich Date: Tue, 17 Jun 2025 05:28:13 +0100 Subject: [PATCH] Add custom url (#44) * add custom_html_url parameter * Update action.yml * Update README.md * Update test.yml * fix: fixed embedMsg url property --------- Co-authored-by: SethCohen <47002293+SethCohen@users.noreply.github.com> --- .github/workflows/test.yml | 1 + README.md | 2 ++ action.yml | 5 ++++- index.js | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0415352..7a1ce1c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,6 +15,7 @@ jobs: color: ${{ inputs.COLOR }} username: ${{ inputs.USERNAME }} avatar_url: ${{ inputs.AVATAR_URL }} + custom_html_url: ${{ inputs.CUSTOM_HTML_URL }} content: ${{ inputs.CONTENT }} footer_title: ${{ inputs.FOOTER_TITLE }} footer_icon_url: ${{ inputs.FOOTER_ICON_URL }} diff --git a/README.md b/README.md index c1e4d7a..2607b4f 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ A GitHub Action that sends a stylized Discord webhook containing the description | color | ❌ | "2105893" | Decimal color value for embed. | | username | ❌ | | String username for webhook. | | avatar_url | ❌ | | String url to webhook avatar picture. | +| custom_html_url | ❌ | | Replace github release url with custom url | | content | ❌ | | String content for webhook. | | footer_title | ❌ | | String title for the webhook footer. | | footer_icon_url | ❌ | | String url for the webhook footer picture. | @@ -68,6 +69,7 @@ jobs: color: "2105893" username: "Release Changelog" avatar_url: "https://cdn.discordapp.com/avatars/487431320314576937/bd64361e4ba6313d561d54e78c9e7171.png" + custom_html_url: "www.google.com" content: "||@everyone||" footer_title: "Changelog" footer_icon_url: "https://cdn.discordapp.com/avatars/487431320314576937/bd64361e4ba6313d561d54e78c9e7171.png" diff --git a/action.yml b/action.yml index 50b05d2..a7b2cb9 100644 --- a/action.yml +++ b/action.yml @@ -15,6 +15,9 @@ inputs: avatar_url: description: String url to webhook avatar picture. required: false + custom_html_url: + description: If filled, replaces github's release url with your custom html url. + required: false content: description: String content for webhook. required: false @@ -44,4 +47,4 @@ runs: main: 'index.js' branding: icon: file-text - color: blue \ No newline at end of file + color: blue diff --git a/index.js b/index.js index e8758bf..789b932 100644 --- a/index.js +++ b/index.js @@ -185,6 +185,9 @@ const buildEmbedMessage = (name, html_url, description) => { footer: {} }; + if (core.getInput('custom_html_url')) { + embedMsg.url = core.getInput('custom_html_url'); + } if (core.getInput('footer_title')) { embedMsg.footer.text = limitString(core.getInput('footer_title'), 2048); }