From b3d8b14ee642d731e74510148187f72da6a7bcf9 Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Wed, 3 Jun 2020 16:02:12 +0200 Subject: [PATCH] fix(pr): ignore white space and headings when comparing PR bodies --- lib/workers/pr/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/workers/pr/index.ts b/lib/workers/pr/index.ts index 5aaef0796dade0..9fc7e586e968ca 100644 --- a/lib/workers/pr/index.ts +++ b/lib/workers/pr/index.ts @@ -15,8 +15,8 @@ import { getPrBody } from './body'; import { ChangeLogError } from './changelog'; import { codeOwnersForPr } from './code-owners'; -function noWhitespace(input: string): string { - return input.replace(/\r?\n|\r|\s/g, ''); +function noWhitespaceOrHeadings(input: string): string { + return input.replace(/\r?\n|\r|\s|#/g, ''); } function noLeadingAtSymbol(input: string): string { @@ -293,7 +293,8 @@ export async function ensurePr( existingPrBody = existingPrBody.trim(); if ( existingPr.title === prTitle && - noWhitespace(existingPrBody) === noWhitespace(prBody) + noWhitespaceOrHeadings(existingPrBody) === + noWhitespaceOrHeadings(prBody) ) { logger.debug(`${existingPr.displayNumber} does not need updating`); return { prResult: PrResult.NotUpdated, pr: existingPr };