Skip to content

Commit

Permalink
Adopt 'empty' as default value for shell vars, converted to JSON null…
Browse files Browse the repository at this point in the history
… is necessary
  • Loading branch information
bgandon committed Feb 5, 2024
1 parent 25679ce commit bad41f3
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions out
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ for channel in ${channels}; do
if [[ "${always_notify}" != "true" && -z "${TEXT_FILE_CONTENT}" && -n "${text_file}" ]]; then
text_interpolated=""
else
if [[ "${attachments}" == "null" ]]; then
if [[ -z "${attachments}" ]]; then
TEXT_FILE_CONTENT=${TEXT_FILE_CONTENT:-"_(no notification provided)_"}
fi

Expand All @@ -124,7 +124,7 @@ for channel in ${channels}; do
if [[ -z "${text_interpolated}" ]]; then
text_interpolated="_(missing notification text)_"
if [[ -n "${attachments}" ]]; then
text_interpolated="null"
text_interpolated=""
fi
fi

Expand All @@ -138,18 +138,18 @@ for channel in ${channels}; do
--arg "text_interpolated" "${text_interpolated}" \
--arg "username" "${username}" \
--argjson "link_names" "${link_names}" \
--arg "icon_url" "${icon_url}" \
--arg "icon_emoji" "${icon_emoji}" \
--arg "channel" "${channel}" \
--arg "attachments" "${attachments}" \
--arg "icon_url" "${icon_url}" \
--arg "icon_emoji" "${icon_emoji}" \
--arg "channel" "${channel}" \
--arg "attachments" "${attachments}" \
'{
text: $text_interpolated,
username: $username // null,
text: $text_interpolated // null,
username: $username // null,
link_names: $link_names,
icon_url: $icon_url // null,
icon_emoji: $icon_emoji // null,
channel: $channel // null,
attachments: $attachments // null
icon_url: $icon_url // null,
icon_emoji: $icon_emoji // null,
channel: $channel // null,
attachments: $attachments // null
}'
)

Expand Down

0 comments on commit bad41f3

Please sign in to comment.