Skip to content

Commit

Permalink
Merge pull request #2 from hglong16/fix/inputs-thread-id
Browse files Browse the repository at this point in the history
fix: no input message_thread_id
  • Loading branch information
hunghg255 authored Dec 13, 2023
2 parents 2f56550 + ad85e0a commit c8ee754
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
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

0 comments on commit c8ee754

Please sign in to comment.