Discord has a max message length of 2000, keep the PR title below that! #7

Merged
probablycorey merged 1 commits from max-message-length into main 2025-12-03 18:55:32 +00:00
Showing only changes of commit e46fb0dd7a - Show all commits

View File

@ -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
}
}