Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: no input message_thread_id #2

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ with:
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
telegram_bot_token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
telegram_chat_id: ${{ secrets.TELEGRAM_CHAT_ID }}
telegram_message_thread_id: ${{ secrets.TELEGRAM_MESSAGE_THREAD_ID }}
google_chat_webhook: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
ms_teams_webhook: ${{ secrets.MS_TEAMS_WEBHOOK }}
title: "Deploy to Dev"
Expand Down Expand Up @@ -64,6 +65,7 @@ jobs:
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
telegram_bot_token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
telegram_chat_id: ${{ secrets.TELEGRAM_CHAT_ID }}
telegram_message_thread_id: ${{ secrets.TELEGRAM_MESSAGE_THREAD_ID }}
google_chat_webhook: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
ms_teams_webhook: ${{ secrets.MS_TEAMS_WEBHOOK }}
title: "Deploy to Dev"
Expand All @@ -82,7 +84,7 @@ jobs:
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
telegram_bot_token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
telegram_chat_id: ${{ secrets.TELEGRAM_CHAT_ID }}
telegra_message_thread_id: $ {{ secrets.TELEGRAM_MESSAGE_THREAD_ID }}
telegram_message_thread_id: ${{ secrets.TELEGRAM_MESSAGE_THREAD_ID }}
google_chat_webhook: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
ms_teams_webhook: ${{ secrets.MS_TEAMS_WEBHOOK }}
title: "Deploy to Dev"
Expand Down
9 changes: 7 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const getInputs = (): TInputs => {
const slack_username = getInput('slack_username').trim() || '';
const telegram_bot_token = getInput('telegram_bot_token').trim() || '';
const telegram_chat_id = getInput('telegram_chat_id').trim() || '';
const telegram_message_thread_id = getInput('telegram_message_thread_id').trim() || '';
const google_chat_webhook = getInput('google_chat_webhook').trim() || '';
const ms_teams_webhook = getInput('ms_teams_webhook').trim() || '';
const status = getInput('status').trim() || '';
Expand All @@ -55,6 +56,7 @@ export const getInputs = (): TInputs => {
slack_username,
telegram_bot_token,
telegram_chat_id,
telegram_message_thread_id,
google_chat_webhook,
ms_teams_webhook,
title,
Expand Down Expand Up @@ -263,8 +265,11 @@ export function getPayloadTelegram(inputs: Readonly<TInputs>): Object {
parse_mode: 'MarkdownV2',
};

if (inputs.telegram_message_thread_id) {
telegram_payload.message_thread_id = inputs.telegram_message_thread_id;
if (inputs.telegram_message_thread_id !== "") {
telegram_payload = {
...telegram_payload,
message_thread_id: inputs.telegram_message_thread_id
}
}

return telegram_payload;
Expand Down