Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(pr): ignore white space and headings when comparing PR bodies
  • Loading branch information
rarkins committed Jun 3, 2020
1 parent b74a491 commit b3d8b14
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/workers/pr/index.ts
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 };
Expand Down

0 comments on commit b3d8b14

Please sign in to comment.