From 521d5bc6ebed331d5416af307f64ddbd20f08fca Mon Sep 17 00:00:00 2001 From: Adam Moussa Date: Mon, 10 Aug 2026 16:51:57 -0400 Subject: [PATCH] fix(policy): allow Jira keys in commit subjects --- .github/workflows/callable-pr-policy.yaml | 1 - test/pr-policy.test.mjs | 15 ++++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/callable-pr-policy.yaml b/.github/workflows/callable-pr-policy.yaml index 1578840..dbd9537 100644 --- a/.github/workflows/callable-pr-policy.yaml +++ b/.github/workflows/callable-pr-policy.yaml @@ -181,7 +181,6 @@ jobs: const desc = m[4]; 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 (/\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; } diff --git a/test/pr-policy.test.mjs b/test/pr-policy.test.mjs index cc25a82..c6e0978 100644 --- a/test/pr-policy.test.mjs +++ b/test/pr-policy.test.mjs @@ -370,19 +370,16 @@ describe('validateCommitSubject', () => { assert.deepEqual(v.validateCommitSubject('feat!: remove deprecated api'), []); }); - it('rejects subject with Jira key suffix', () => { - const errs = v.validateCommitSubject('fix: patch (DEV-123)'); - assert.ok(errs.some(e => e.includes('Jira')), 'should reject Jira suffix: ' + errs.join('; ')); + it('accepts subject with DEV Jira key suffix', () => { + assert.deepEqual(v.validateCommitSubject('fix: patch (DEV-123)'), []); }); - it('rejects subject with lowercase Jira key suffix (case-insensitive)', () => { - const errs = v.validateCommitSubject('fix: patch (dev-123)'); - assert.ok(errs.some(e => e.includes('Jira')), 'lowercase Jira suffix should also be rejected: ' + errs.join('; ')); + it('accepts subject with AP Jira key suffix', () => { + assert.deepEqual(v.validateCommitSubject('feat(frontend): scaffold vite spa and ci (AP-4)'), []); }); - it('rejects subject with plat Jira key suffix', () => { - const errs = v.validateCommitSubject('chore: update config (plat-5)'); - assert.ok(errs.some(e => e.includes('Jira')), 'plat Jira suffix should be rejected: ' + errs.join('; ')); + it('accepts subject with PLAT Jira key suffix', () => { + assert.deepEqual(v.validateCommitSubject('chore: update config (PLAT-5)'), []); }); it('rejects non-conventional subject', () => {