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

fix(commit-lint): make commit-lint more robust #5

Merged
merged 1 commit into from
Jun 17, 2024
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
21 changes: 13 additions & 8 deletions .github/workflows/commit-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,19 @@ jobs:
const { type, subject } = parsedCommit;
if (type === 'chore' && subject?.startsWith('update')) return [true]; // skip renovate and extimage bumps

const trailers = execSync('git interpret-trailers --parse', {
input: parsedCommit.raw || '',
}).toString();
const matches = toLines(trailers).filter((ln) => ln.match(/^risk:\s*nonprod|low|high/i)).length
return [
matches === 1,
`Should have exactly one risk label of value nonprod|low|high, but ${matches} found.`,
];
try {
const trailers = execSync('git interpret-trailers', ['--parse'], {
input: parsedCommit.raw || '',
}).toString();
const matches = toLines(trailers)?.filter((ln) => ln.match(/^risk:\s*nonprod|low|high/i))?.length
return [
matches === 1,
`Should have exactly one risk label of value nonprod|low|high, but ${matches} found.`,
];
} catch (err) {
console.error(err.toString());
return [false, 'Error while trying to find risk label'];
}
},
},
},
Expand Down
Loading