Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix angular components sync regex #2477

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions scripts/angular-components-sync.mts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ const commitsInIssueRegex = new RegExp(
);
const lastSynchronizationTitle = `Last synchronization:`;
const lastSynchronizationInIssueRegex = new RegExp(
escapeRegex(lastSynchronizationTitle) + '\r\n' + '`(.*)`\r\n',
escapeRegex(lastSynchronizationTitle) + '\n' + '`(.*)`\n',
's',
);
const lastCheckedShaTitle = `Last checked sha:`;
const lastCheckedShaInIssueRegex = new RegExp(
escapeRegex(lastCheckedShaTitle) + '\r\n' + '`(.*)`',
escapeRegex(lastCheckedShaTitle) + '\n' + '`(.*)`',
's',
);
const emptyListInIssueMessage = 'No unchecked commits';
Expand Down Expand Up @@ -128,7 +128,7 @@ export class AngularComponentsSync {
: issueBody
.match(commitsInIssueRegex)![1]
.trim()
.split('\r\n')
.split('\n')
.map((line) => ({
checked: line.startsWith('- [x]'),
sha: line.match(/angular\/components\/commit\/(.*)\)/)![1],
Expand All @@ -142,14 +142,14 @@ export class AngularComponentsSync {
issueBody: IssueBody,
newReferenceSha: string,
) {
const commitsInIssueBlock = `${commitsInIssueStart}\r\n${
const commitsInIssueBlock = `${commitsInIssueStart}\n${
commitsInRange.length
? this._createIssueCommits(commitsInRange, issueBody)
: emptyListInIssueMessage
}\r\n\r\n${commitsInIssueEnd}`;
}\n\n${commitsInIssueEnd}`;

const lastShaBlock = `${lastCheckedShaTitle}\r\n\`${newReferenceSha}\``;
const lastSynchronizationBlock = `${lastSynchronizationTitle}\r\n\`${this._now.toISOString()}\`\r\n`;
const lastShaBlock = `${lastCheckedShaTitle}\n\`${newReferenceSha}\``;
const lastSynchronizationBlock = `${lastSynchronizationTitle}\n\`${this._now.toISOString()}\`\n`;

return issueBody.body
.replace(commitsInIssueRegex, commitsInIssueBlock)
Expand All @@ -169,7 +169,7 @@ export class AngularComponentsSync {
commit.sha,
),
)
.join('\r\n');
.join('\n');
}

private _createIssueCommitLine(checked: boolean, subject: string, sha: string) {
Expand Down
Loading