Skip to content

Commit

Permalink
feat: comma separated values
Browse files Browse the repository at this point in the history
  • Loading branch information
Netail committed Mar 29, 2024
1 parent 07edbe1 commit 3856b12
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- uses: Netail/webhook-notifier@v1
with:
discord-url: 'https://discord.com/api/webhooks/...'
slack-url: 'https://hooks.slack.com/services/...'
slack-url: 'https://hooks.slack.com/services/..., https://hooks.slack.com/services/...'
teams-url: '["https://outlook.office.com/webhook/...", "https://outlook.office.com/webhook/..."]'
color: 'info'
title: '${{ github.event.pull_request.user.login }} opened PR-${{ github.event.number }} in ${{ github.event.repository.name }}'
Expand All @@ -46,9 +46,9 @@ The action has any of the follow inputs
| Name | Description | Default | Notes |
| - | - | - | - |
| `dry-run` | Prevent sending the payload | false | |
| `discord-url` | Discord Webhook URL(s) | N/A | Optional: Can be stringified JSON array of strings. Discord does not support buttons in incoming webhooks, yet |
| `slack-url` | Slack Webhook URL(s) | N/A | Optional: Can be stringified JSON array of strings. |
| `teams-url` | Teams Webhook URL(s) | N/A | Optional: Can be stringified JSON array of strings. Teams has deprecated colors in cards (temporarily) |
| `discord-url` | Discord Webhook URL(s) | N/A | Optional: Can be comma separated values, or stringified JSON array of strings. Discord does not support buttons in incoming webhooks, yet |
| `slack-url` | Slack Webhook URL(s) | N/A | Optional: Can be comma separated values, or stringified JSON array of strings. |
| `teams-url` | Teams Webhook URL(s) | N/A | Optional: Can be comma separated values, or stringified JSON array of strings. Teams has deprecated colors in cards (temporarily) |
| `color` | Color of the message | `success` | Value can be in hexadecimal or the title of a predefined color |
| `title` | Text at the top of the message | `Hello world!` | |
| `text` | Text to be displayed under the title | N/A | |
Expand Down
8 changes: 4 additions & 4 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/helpers/send-payload.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const sendPayload = async (
return { key, success: true };
}

const response = await fetch(url, {
const response = await fetch(url.trim(), {
method: 'POST',
body: JSON.stringify(payload),
headers: {
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const run = async (): Promise<void> => {

discordURLs = isJSONArray
? parseJSONInput<string[]>('discord-url', rawDiscordURL)
: [rawDiscordURL];
: rawDiscordURL.split(',');
}

const rawTeamsURL = getInput('teams-url');
Expand All @@ -34,7 +34,7 @@ const run = async (): Promise<void> => {

teamsURLs = isJSONArray
? parseJSONInput<string[]>('teams-url', rawTeamsURL)
: [rawTeamsURL];
: rawTeamsURL.split(',');
}

const rawSlackURL = getInput('slack-url');
Expand All @@ -46,7 +46,7 @@ const run = async (): Promise<void> => {

slackURLs = isJSONArray
? parseJSONInput<string[]>('slack-url', rawSlackURL)
: [rawSlackURL];
: rawSlackURL.split(',');
}

if (
Expand Down

0 comments on commit 3856b12

Please sign in to comment.