Skip to content

Commit 61ef7a0

Browse files
ci: fix high-risk comment checklist parsing
Drop the leading space before the file list and allow optional indent so the first checklist item is not skipped on parse.
1 parent 8af0c7b commit 61ef7a0

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎.github/workflows/changes-in-high-risk-code.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,20 @@ jobs:
5151
const fileList = files
5252
.map(file => `- [${checkedFiles.has(file) ? 'x' : ' '}] ${file}`)
5353
.join('\n');
54-
return `${intro}\n ${fileList}`;
54+
return `${intro}\n${fileList}`;
5555
};
5656
5757
const parseCheckedFiles = (commentBody = '') => {
5858
const checked = new Set();
59-
for (const match of commentBody.matchAll(/^- \[x\] (.+)$/gim)) {
59+
for (const match of commentBody.matchAll(/^[ \t]*- \[x\] (.+)$/gim)) {
6060
checked.add(match[1].trim());
6161
}
6262
return checked;
6363
};
6464
6565
const parseListedFiles = (commentBody = '') => {
6666
const listed = [];
67-
for (const match of commentBody.matchAll(/^- \[[ xX]\] (.+)$/gim)) {
67+
for (const match of commentBody.matchAll(/^[ \t]*- \[[ xX]\] (.+)$/gim)) {
6868
listed.push(match[1].trim());
6969
}
7070
return listed;

0 commit comments

Comments
 (0)