mirror of
https://github.com/Sea-Haven-Industries/.github.git
synced 2026-09-30 08:13:12 +00:00
fix(policy): allow Jira keys in commit subjects
This commit is contained in:
parent
0d802eae33
commit
521d5bc6eb
2 changed files with 6 additions and 10 deletions
1
.github/workflows/callable-pr-policy.yaml
vendored
1
.github/workflows/callable-pr-policy.yaml
vendored
|
|
@ -181,7 +181,6 @@ jobs:
|
||||||
const desc = m[4];
|
const desc = m[4];
|
||||||
if (!/^[a-z]/.test(desc)) errs.push('Commit description must start with a lowercase letter');
|
if (!/^[a-z]/.test(desc)) errs.push('Commit description must start with a lowercase letter');
|
||||||
if (desc.endsWith('.')) errs.push('Commit description must not end with a period');
|
if (desc.endsWith('.')) errs.push('Commit description must not end with a period');
|
||||||
if (/\s+\((DEV|PLAT|SEC|AP)-\d+\)$/i.test(subject)) errs.push('Commit subject must not carry a Jira key suffix — only the PR title does');
|
|
||||||
return errs;
|
return errs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -370,19 +370,16 @@ describe('validateCommitSubject', () => {
|
||||||
assert.deepEqual(v.validateCommitSubject('feat!: remove deprecated api'), []);
|
assert.deepEqual(v.validateCommitSubject('feat!: remove deprecated api'), []);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('rejects subject with Jira key suffix', () => {
|
it('accepts subject with DEV Jira key suffix', () => {
|
||||||
const errs = v.validateCommitSubject('fix: patch (DEV-123)');
|
assert.deepEqual(v.validateCommitSubject('fix: patch (DEV-123)'), []);
|
||||||
assert.ok(errs.some(e => e.includes('Jira')), 'should reject Jira suffix: ' + errs.join('; '));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('rejects subject with lowercase Jira key suffix (case-insensitive)', () => {
|
it('accepts subject with AP Jira key suffix', () => {
|
||||||
const errs = v.validateCommitSubject('fix: patch (dev-123)');
|
assert.deepEqual(v.validateCommitSubject('feat(frontend): scaffold vite spa and ci (AP-4)'), []);
|
||||||
assert.ok(errs.some(e => e.includes('Jira')), 'lowercase Jira suffix should also be rejected: ' + errs.join('; '));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('rejects subject with plat Jira key suffix', () => {
|
it('accepts subject with PLAT Jira key suffix', () => {
|
||||||
const errs = v.validateCommitSubject('chore: update config (plat-5)');
|
assert.deepEqual(v.validateCommitSubject('chore: update config (PLAT-5)'), []);
|
||||||
assert.ok(errs.some(e => e.includes('Jira')), 'plat Jira suffix should be rejected: ' + errs.join('; '));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('rejects non-conventional subject', () => {
|
it('rejects non-conventional subject', () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue