Merge pull request 'Discord has a max message length of 2000, keep the PR title below that!' (#7) from max-message-length into main
Some checks are pending
CI / test (push) Waiting to run
Some checks are pending
CI / test (push) Waiting to run
Reviewed-on: #7
This commit is contained in:
commit
78c0dcf2e5
|
|
@ -106,7 +106,7 @@ export class PRHandler {
|
|||
|
||||
static formatPrBody(pullRequest: Gitea.PullRequest, repositoryFullName: string): string {
|
||||
const body = pullRequest.body || "_empty_"
|
||||
return `
|
||||
let message = `
|
||||
> ### [${pullRequest.title}](<${pullRequest.html_url}>)
|
||||
> **${repositoryFullName}**
|
||||
>
|
||||
|
|
@ -115,6 +115,13 @@ export class PRHandler {
|
|||
.map((line) => `> ${line}`)
|
||||
.join("\n")}
|
||||
`
|
||||
|
||||
const maxMessageSize = 2000
|
||||
const truncateMessage = `\n_message truncated. View full PR on Gitea_`
|
||||
|
||||
if (message.length < maxMessageSize) return message
|
||||
|
||||
return message.slice(0, maxMessageSize - 1 - truncateMessage.length) + truncateMessage
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user