-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify-commit.js
More file actions
21 lines (18 loc) · 540 Bytes
/
Copy pathverify-commit.js
File metadata and controls
21 lines (18 loc) · 540 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const { execSync } = require('child_process');
const commitMsgFile = process.argv[2];
if (!commitMsgFile) {
console.error('Error: No commit message file argument provided.');
process.exit(1);
}
try {
// Use the locally installed commitlint
try {
execSync(`npx commitlint --edit "${commitMsgFile}"`, { stdio: 'inherit' });
} catch (error) {
// commitlint will print its own errors to stdout/stderr
process.exit(1);
}
} catch (err) {
console.error('Error reading commit message file:', err);
process.exit(1);
}