Skip to content

Commit

Permalink
Merge branch 'main' into turbo-module/release-b8cda0e95cbb-canary
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Jun 21, 2024
2 parents b557cb6 + 5c8d28c commit 047e9b0
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions packages/action/src/util/get-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ const capitalise = (str: string) =>

// GitHub enforces a max length of 65536 characters for a pull request body
const maxLength = 65536;
const lengthBuffer = 1000;

export const makeGithubReleaseMessage = (stats: ReleaseStats) =>
`
export const makeGithubReleaseMessage = (stats: ReleaseStats) => {
const message = `
${Object.entries(stats.pulls)
.map(
([key, pulls]) => `
Expand All @@ -25,9 +26,17 @@ ${pulls.map(({ title }) => `- ${title}`).join('\n')}
${Array.from(stats.authors)
.map((author) => `@${author}`)
.join(', ')}
`
.trim()
.slice(0, maxLength);
`.trim();

if (message.length >= maxLength - lengthBuffer) {
return `${message.slice(
0,
maxLength - lengthBuffer,
)}...\nThis message has been truncated to avoid exceeding the GitHub API's body limit.`;
}

return message;
};

const getReleaseMessage = async (prerelease: boolean) => {
const latestRelease = await getLatestRelease(prerelease);
Expand Down

0 comments on commit 047e9b0

Please sign in to comment.