Skip to content

Commit babcd4b

Browse files
feat: add bash syntax checking for .sh files in lint-readme script (#115)
1 parent 15534b2 commit babcd4b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

.github/scripts/lint-readme.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,21 @@ allScripts.forEach(file => {
7777
}
7878
});
7979

80+
// Check bash syntax for all .sh files
81+
allScripts.forEach(file => {
82+
if (!file.endsWith('.sh')) {
83+
return;
84+
}
85+
86+
const filePath = path.join(directoryPath, file);
87+
try {
88+
execSync(`bash -n "${filePath}"`, { stdio: 'pipe' });
89+
} catch (error) {
90+
console.log(`Bash syntax error in ${file}: ${error.stderr.toString().trim()}`);
91+
issueCount++;
92+
}
93+
});
94+
8095
// Extract the part of the README under the ## Scripts heading
8196
const scriptsSection = readme.split(`${parentHeading}\n`)[1];
8297

0 commit comments

Comments
 (0)