Skip to content

Commit

Permalink
feat: dist & bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Netail committed Mar 29, 2024
1 parent f0042ea commit fd2eff1
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 48 deletions.
126 changes: 85 additions & 41 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.

6 changes: 3 additions & 3 deletions src/helpers/send-payload.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ export const sendPayload = async (
});

if (response.ok) {
debug(`Successfully sent ${key} payload to`);
debug(`Successfully sent payload to ${key}`);
return { key, success: true };
} else {
error(
`Failed sending the ${key} payload to. API returned HTTP status ${response.status}`
`Failed sending the payload to ${key}. API returned HTTP status ${response.status}`
);
return { key, success: false };
}
} catch (err) {
if (err instanceof Error) {
error(`Failed sending the ${key} payload to. Error:`, err.message);
error(`Failed sending the payload to ${key}`);
}

return { key, success: false };
Expand Down
18 changes: 15 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,35 @@ const run = async (): Promise<void> => {
const rawDiscordURL = getInput('discord-url');
let discordURLs: string[] = [];
if (rawDiscordURL) {
discordURLs = rawDiscordURL.startsWith('[')
const isJSONArray = rawDiscordURL.startsWith('[');

debug(`Found Slack input ${isJSONArray ? '(Multiple)' : ''}`);

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

const rawTeamsURL = getInput('teams-url');
let teamsURLs: string[] = [];
if (rawTeamsURL) {
teamsURLs = rawTeamsURL.startsWith('[')
const isJSONArray = rawTeamsURL.startsWith('[');

debug(`Found Slack input ${isJSONArray ? '(Multiple)' : ''}`);

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

const rawSlackURL = getInput('slack-url');
let slackURLs: string[] = [];
if (rawSlackURL) {
slackURLs = rawSlackURL.startsWith('[')
const isJSONArray = rawSlackURL.startsWith('[');

debug(`Found Slack input ${isJSONArray ? '(Multiple)' : ''}`);

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

0 comments on commit fd2eff1

Please sign in to comment.