diff --git a/tools/pull_request_hooks/removeGuideComments.js b/tools/pull_request_hooks/removeGuideComments.js index 5f05dacd10c..c7cdcd1ca67 100644 --- a/tools/pull_request_hooks/removeGuideComments.js +++ b/tools/pull_request_hooks/removeGuideComments.js @@ -18,6 +18,11 @@ function escapeRegex(string) { export async function removeGuideComments({ github, context }) { let newBody = context.payload.pull_request.body; + if (!newBody) { + console.log("PR body is empty, skipping..."); + return; + } + for (const comment of comments) { newBody = newBody.replace( new RegExp(`^\\s*${escapeRegex(comment)}\\s*`, "gm"),