Skip to content

Commit

Permalink
sendSlackMessage: preserve last md slack section
Browse files Browse the repository at this point in the history
  • Loading branch information
thypon committed Dec 2, 2024
1 parent 20447b9 commit 7721eea
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/sendSlackMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,17 @@ export default async function sendSlackMessage ({
let mdBlocks = await markdownToBlocks(message)
// slack blocks have a limit of 50 blocks, remove the last blocks if there are more
if (mdBlocks.length > 50) {
mdBlocks = mdBlocks.slice(0, 49)
// last block should contain the Cc, so we don't want to remove it
const lastBlock = mdBlocks[mdBlocks.length - 1]
mdBlocks = mdBlocks.slice(0, 48)
mdBlocks.push({
type: 'section',
text: {
type: 'mrkdwn',
text: '...and more'
}
})
mdBlocks.push(lastBlock)
}
if (colored) {
attachments = [{
Expand Down

0 comments on commit 7721eea

Please sign in to comment.