Skip to content

Commit

Permalink
Fix incoming webhook being true on empty string as url
Browse files Browse the repository at this point in the history
It seems Github actions sets empty string as default value for inputs.
  • Loading branch information
krissrex authored Aug 30, 2024
1 parent 79bc809 commit c9d817a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion slack-notify/action.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const body = JSON.stringify({
if (dryRun) {
appendFileSync(process.env.GITHUB_OUTPUT, `payload=${body}\n`)
} else {
const useIncomingWebhook = incomingWebhookUrl !== undefined
const useIncomingWebhook = Boolean(incomingWebhookUrl) // null, undefined or empty string means false.
const endpointUrl = useIncomingWebhook ? incomingWebhookUrl : "https://slack.com/api/chat.postMessage"
const response = await fetch(endpointUrl, {
method: "POST",
Expand Down

0 comments on commit c9d817a

Please sign in to comment.