From fb45c5c61560062058953fef9450354aa9fb4b18 Mon Sep 17 00:00:00 2001 From: Manish Maharjan <112875432+mmaharjan-ccdc@users.noreply.github.com> Date: Tue, 15 Sep 2026 10:33:25 +0100 Subject: [PATCH 1/3] SYS-8736 open-source exempt from Jira validation, added regression tests for Opensource, and unsupported types --- README.md | 15 +++++++++++++++ main/githooks.py | 29 ++++++++++++++++++++++++----- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3f2e6b5..fc300c1 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,21 @@ The commit will also be flagged if the commit message does not include a Jira ID (unless marked with NO_JIRA or a Copilot Autofix co-author line), or if the size of new or modified files exceeds a threshold. +## Conventional Commits + +Conventional Commits validation is optional. Add a `.conventional-commits` file +at the repository root to enable it. The supported header format is: + +```text +(): +``` + +Supported types are `break`, `feat`, `fix`, `refactor`, `build`, `chore`, `ci`, +`docs`, `perf`, `revert`, `style`, and `test`. CCDC release configurations use +`break` for a major version. A branch may contain more than one type. +Releases should choose the highest required version bump, +so `break` takes precedence over `feat`, which takes precedence over `fix`. + # GitHub Actions diff --git a/main/githooks.py b/main/githooks.py index 035d75e..7059823 100644 --- a/main/githooks.py +++ b/main/githooks.py @@ -960,11 +960,6 @@ def check_commit_msg(message, files, repo): # Not checking for JIRA or large file in commit message generated by github return 0 - if re.match(r'^ccdc-opensource/', repo): - # Do not check for JIRA in opensource repo as we don't want to require external contributors to do this - return 0 - - # Check for Conventional Commits compliance. # Opt-in per repo: commit an empty marker file named # `.conventional-commits` at the repo root. @@ -977,6 +972,8 @@ def check_commit_msg(message, files, repo): return 1 if ( + not re.match(r'^ccdc-opensource/', repo) + and NO_JIRA_MARKER not in message and copilot_autofix_coauthor_pattern.search(message) is None and jira_id_pattern.search(message) is None @@ -1071,6 +1068,28 @@ def _test(input, is_good=True): _test('I forgot to add the jira marker!', False) _test('Close but no cigar abc-1234', False) + @patch('githooks._conventional_commits_enabled', return_value=True) + def test_opensource_repo_still_checks_conventional_commit(self, _enabled): + self.assertEqual(0, check_commit_msg('feat: valid change', [], 'ccdc-opensource/example')) + self.assertEqual(1, check_commit_msg('invalid: invalid change', [], 'ccdc-opensource/example')) + + +class TestConventionalCommitPresent(unittest.TestCase): + def test_supported_types(self): + for commit_type in ( + 'break', 'feat', 'fix', 'refactor', 'build', 'chore', 'ci', + 'docs', 'perf', 'revert', 'style', 'test' + ): + with self.subTest(commit_type=commit_type): + self.assertTrue(conventional_commit_present(f'{commit_type}: subject')) + + def test_scope_and_multiline_description(self): + self.assertTrue(conventional_commit_present('feat(api): subject\n\nMore detail')) + + def test_unsupported_type(self): + self.assertFalse(conventional_commit_present('invalid(PLA-3474): test')) + self.assertFalse(conventional_commit_present('breaking-change: test')) + def run_licence_check(files): '''Check or fix complete CCDC licence headers. From b74c8287fbd32b1ee8780b74c539e7c9dde18f70 Mon Sep 17 00:00:00 2001 From: Manish Maharjan <112875432+mmaharjan-ccdc@users.noreply.github.com> Date: Tue, 15 Sep 2026 10:53:33 +0100 Subject: [PATCH 2/3] SYS-8736 update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fc300c1..e2808fd 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Conventional Commits validation is optional. Add a `.conventional-commits` file at the repository root to enable it. The supported header format is: ```text -(): +(): ``` Supported types are `break`, `feat`, `fix`, `refactor`, `build`, `chore`, `ci`, From f5c330201edf0f8f7a452d76be3407ab749aad60 Mon Sep 17 00:00:00 2001 From: Manish Maharjan <112875432+mmaharjan-ccdc@users.noreply.github.com> Date: Tue, 15 Sep 2026 11:04:56 +0100 Subject: [PATCH 3/3] SYS-8736 add examples into readme --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index e2808fd..1ed5350 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,18 @@ Conventional Commits validation is optional. Add a `.conventional-commits` file at the repository root to enable it. The supported header format is: ```text +: (): ``` +Examples: + +```text +fix: handle an empty search response +feat(PLA-0001): add structure filtering +break(NO_JIRA): remove the legacy search endpoint +``` + Supported types are `break`, `feat`, `fix`, `refactor`, `build`, `chore`, `ci`, `docs`, `perf`, `revert`, `style`, and `test`. CCDC release configurations use `break` for a major version. A branch may contain more than one type.