Skip to content

Commit

Permalink
Merge pull request #254 from tise/send-threaded-message
Browse files Browse the repository at this point in the history
Allow sending threaded message
  • Loading branch information
ostwalprasad authored Feb 21, 2025
2 parents 3e2ee81 + 83c9874 commit 68108d2
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ inputs:
required: false
description: 'Include ref in title'
default: true
threaded_message:
required: false
description: 'Message to send in a threaded message'
mention:
required: false
description: 'Mention a group (e.g. here)'
Expand Down
10 changes: 9 additions & 1 deletion 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.

11 changes: 10 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ async function run(): Promise<void> {
const subject = core.getInput('subject')
const event = core.getInput('event')
const mention = core.getInput('mention')
const threaded_message = core.getInput('threaded_message')

const repoUrl = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}`
const runUrl = `${repoUrl}/actions/runs/${process.env.GITHUB_RUN_ID}`
Expand All @@ -34,7 +35,7 @@ async function run(): Promise<void> {
...(message ? [message] : [])
].join('\n')

await client.chat.postMessage({
const response = await client.chat.postMessage({
username: core.getInput('username'),
icon_emoji: core.getInput('icon_emoji') || undefined,
channel: core.getInput('channel'),
Expand Down Expand Up @@ -62,6 +63,14 @@ async function run(): Promise<void> {
}
]
})

if (threaded_message && response.ts) {
await client.chat.postMessage({
channel: core.getInput('channel'),
text: threaded_message,
thread_ts: response.ts
})
}
}

;(async () => {
Expand Down

0 comments on commit 68108d2

Please sign in to comment.