Skip to content

Commit

Permalink
Merge pull request #13500 from Expensify/francois-fixGetMergeLogsAsJSON
Browse files Browse the repository at this point in the history
Prevent commit messages that end in `\` from breaking `getMergeLogsAsJSON()`
  • Loading branch information
mountiny authored Dec 13, 2022
2 parents e382f07 + 012856a commit ab80331
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,11 @@ function getMergeLogsAsJSON(fromRef, toRef) {
sanitizedOutput = sanitizedOutput.replace(/(\r\n|\n|\r)/gm, '');

// Then format as JSON and convert to a proper JS object
const json = `[${sanitizedOutput}]`.replace('},]', '}]');
const json = `[${sanitizedOutput}]`.replace('},]', '}]')

// Escape backslashes in commit messages that end with a backslash
.replace('\\"}', '\\\\"}');

return JSON.parse(json);
});
}
Expand Down
6 changes: 5 additions & 1 deletion .github/actions/javascript/getDeployPullRequestList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ function getMergeLogsAsJSON(fromRef, toRef) {
sanitizedOutput = sanitizedOutput.replace(/(\r\n|\n|\r)/gm, '');

// Then format as JSON and convert to a proper JS object
const json = `[${sanitizedOutput}]`.replace('},]', '}]');
const json = `[${sanitizedOutput}]`.replace('},]', '}]')

// Escape backslashes in commit messages that end with a backslash
.replace('\\"}', '\\\\"}');

return JSON.parse(json);
});
}
Expand Down
6 changes: 5 additions & 1 deletion .github/libs/GitUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ function getMergeLogsAsJSON(fromRef, toRef) {
sanitizedOutput = sanitizedOutput.replace(/(\r\n|\n|\r)/gm, '');

// Then format as JSON and convert to a proper JS object
const json = `[${sanitizedOutput}]`.replace('},]', '}]');
const json = `[${sanitizedOutput}]`.replace('},]', '}]')

// Escape backslashes in commit messages that end with a backslash
.replace('\\"}', '\\\\"}');

return JSON.parse(json);
});
}
Expand Down

0 comments on commit ab80331

Please sign in to comment.