Skip to content

Commit 96f9299

Browse files
committed
github: scripts: Address a coderabbitai comment
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
1 parent 9b51c5a commit 96f9299

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

.github/scripts/commit_prefix_check.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,17 @@ def validate_commit(commit):
237237
# or if it's an umbrella prefix that doesn't match.
238238
if len(non_build_prefixes) > 1:
239239
# Only umbrella prefixes are allowed to cover multiple components
240-
if subj_lower not in umbrella_prefixes:
240+
if subj_lower in umbrella_prefixes:
241+
# Ensure all changed paths are within the umbrella domain
242+
norm_paths = [p.replace(os.sep, "/") for p in files]
243+
if not all(p.startswith("lib/") for p in norm_paths):
244+
expected_list = sorted(expected)
245+
expected_str = ", ".join(expected_list)
246+
return False, (
247+
f"Subject prefix '{subject_prefix}' does not match files changed.\n"
248+
f"Expected one of: {expected_str}"
249+
)
250+
elif subj_lower not in umbrella_prefixes:
241251
expected_list = sorted(expected)
242252
expected_str = ", ".join(expected_list)
243253
return False, (

0 commit comments

Comments
 (0)