Skip to content

Commit e9a84dc

Browse files
Apply suggestions from code review
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Ash Shaw <[email protected]>
1 parent 0aba74a commit e9a84dc

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

scripts/canonical-to-json.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@ const outDir = path.join('.github', 'automation', 'canonical', 'json');
99
fs.mkdirSync(outDir, { recursive: true });
1010

1111
for (const file of ['repository-categories.yml','repository-names.yml','labels.yml']) {
12-
const y = fs.readFileSync(path.join(srcDir, file), 'utf8');
13-
const j = YAML.parse(y);
14-
fs.writeFileSync(path.join(outDir, file.replace(/\.yml$/, '.json')), JSON.stringify(j, null, 2));
12+
try {
13+
const y = fs.readFileSync(path.join(srcDir, file), 'utf8');
14+
const j = YAML.parse(y);
15+
fs.writeFileSync(path.join(outDir, file.replace(/\.yml$/, '.json')), JSON.stringify(j, null, 2));
16+
} catch (err) {
17+
console.error(`Failed to process ${file}:`, err.message);
18+
process.exit(1);
19+
}
1520
}
1621
console.log('Canonical JSON generated.');

0 commit comments

Comments
 (0)