Skip to content

Commit

Permalink
[Slack] Add a limit on the maximum size of attachments for publishing…
Browse files Browse the repository at this point in the history
… changelog

If you exceed 50 attachment objects when publishing, you get an error from the Slack server - Upload error, code=400, reason=invalid_attachments.
This crashes the whole build without the ability to save changelog.
Therefore, it is necessary to forcibly limit the number of attachments.
  • Loading branch information
Roman Chetverikov committed Oct 1, 2024
1 parent 83fef8a commit 19894ea
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ abstract class SendSlackChangelogWork
color = parameters.attachmentColor.get(),
blocks =
listOf(buildSectionBlock(parameters.userMentions.get()))
.plus(changelogMessages.map { buildSectionBlock(it) }),
.plus(changelogMessages.map { buildSectionBlock(it) })
.take(MAX_ATTACHMENTS_COUNT),
),
),
)
Expand Down Expand Up @@ -94,3 +95,4 @@ private const val TEXT_TYPE_MARKDOWN = "mrkdwn"
private const val TEXT_TYPE_PLAIN_TEXT = "plain_text"

private const val MAX_BLOCK_SYMBOLS = 3000
private const val MAX_ATTACHMENTS_COUNT = 50

0 comments on commit 19894ea

Please sign in to comment.