diff --git a/dist/index.js b/dist/index.js index c9735a6..5d98d99 100644 --- a/dist/index.js +++ b/dist/index.js @@ -334,6 +334,11 @@ function createPullRequest(inputs) { // Update the body input with the contents of the file inputs.body = utils.readFile(inputs.bodyPath); } + // 65536 characters is the maximum allowed for the pull request body. + if (inputs.body.length > 65536) { + core.warning(`Pull request body is too long. Truncating to 65536 characters.`); + inputs.body = inputs.body.substring(0, 65536); + } // Get the repository path const repoPath = utils.getRepoPath(inputs.path); // Create a git command manager diff --git a/src/create-pull-request.ts b/src/create-pull-request.ts index 309bb67..9535b7b 100644 --- a/src/create-pull-request.ts +++ b/src/create-pull-request.ts @@ -46,6 +46,13 @@ export async function createPullRequest(inputs: Inputs): Promise { // Update the body input with the contents of the file inputs.body = utils.readFile(inputs.bodyPath) } + // 65536 characters is the maximum allowed for the pull request body. + if (inputs.body.length > 65536) { + core.warning( + `Pull request body is too long. Truncating to 65536 characters.` + ) + inputs.body = inputs.body.substring(0, 65536) + } // Get the repository path const repoPath = utils.getRepoPath(inputs.path)