Skip to content

Commit

Permalink
remove newlines before replacing end bracket
Browse files Browse the repository at this point in the history
  • Loading branch information
yuwenmemon committed Jan 17, 2023
1 parent 8dd8b30 commit b909655
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ function getMergeLogsAsJSON(fromRef, toRef) {
// Sanitize just the text within commit subjects as that's the only potentially un-parseable text.
const sanitizedOutput = stdout.replace(/(?<="subject": ").*?(?="})/g, subject => sanitizeStringForJSONParse(subject));

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

return JSON.parse(json);
});
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/javascript/getDeployPullRequestList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ function getMergeLogsAsJSON(fromRef, toRef) {
// Sanitize just the text within commit subjects as that's the only potentially un-parseable text.
const sanitizedOutput = stdout.replace(/(?<="subject": ").*?(?="})/g, subject => sanitizeStringForJSONParse(subject));

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

return JSON.parse(json);
});
Expand Down
4 changes: 2 additions & 2 deletions .github/libs/GitUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ function getMergeLogsAsJSON(fromRef, toRef) {
// Sanitize just the text within commit subjects as that's the only potentially un-parseable text.
const sanitizedOutput = stdout.replace(/(?<="subject": ").*?(?="})/g, subject => sanitizeStringForJSONParse(subject));

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

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

0 comments on commit b909655

Please sign in to comment.