Skip to content

Commit 74f47c6

Browse files
committed
fix(ci): enforce issue number in commit messages (#5)
1 parent e1aaa83 commit 74f47c6

3 files changed

Lines changed: 18 additions & 10 deletions

File tree

.commitlintrc.cjs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
module.exports = {
22
extends: ['@commitlint/config-conventional'],
3+
plugins: [
4+
{
5+
rules: {
6+
'issue-number-required': (parsed) => {
7+
const { subject } = parsed;
8+
const issuePattern = /#\d+/;
9+
10+
if (!subject || !issuePattern.test(subject)) {
11+
return [false, 'commit message must include issue number (e.g., #123)'];
12+
}
13+
14+
return [true];
15+
}
16+
}
17+
}
18+
],
319
rules: {
20+
'issue-number-required': [2, 'always'],
421
'type-enum': [
522
2,
623
'always',
@@ -31,13 +48,6 @@ module.exports = {
3148
],
3249

3350
'subject-empty': [2, 'never'],
34-
'subject-max-length': [2, 'always', 72],
35-
36-
'subject-pattern': [2, 'always', '.*\\(#[0-9]+\\)$'],
37-
'subject-pattern-error-message': [
38-
2,
39-
'always',
40-
'Commit subject must end with an issue reference like "(#123)".'
41-
]
51+
'subject-max-length': [2, 'always', 72]
4252
}
4353
};

.github/ISSUE_TEMPLATE/incident.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: incident
22
description: Production incident / service outage
3-
title: "[INCIDENT] "
43
labels: ["incident"]
54
body:
65
- type: input

.github/ISSUE_TEMPLATE/postmortem.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: postmortem
22
description: Incident postmortem / root cause analysis
3-
title: "[POSTMORTEM] "
43
labels: ["postmortem"]
54
body:
65
- type: input

0 commit comments

Comments
 (0)