One more fix for reviewer assignment (#36829)
* one more fix * one more fix * Trigger tests
This commit is contained in:
10
.github/scripts/assign_reviewers.py
vendored
10
.github/scripts/assign_reviewers.py
vendored
@@ -22,12 +22,16 @@ from collections import Counter
|
||||
from pathlib import Path
|
||||
|
||||
def pattern_to_regex(pattern):
|
||||
start_anchor = pattern.startswith("/")
|
||||
pattern = re.escape(pattern)
|
||||
if pattern.startswith("/"):
|
||||
start_anchor = True
|
||||
pattern = re.escape(pattern[1:])
|
||||
else:
|
||||
start_anchor = False
|
||||
pattern = re.escape(pattern)
|
||||
# Replace `*` with "any number of non-slash characters"
|
||||
pattern = pattern.replace(r"\*", "[^/]*")
|
||||
if start_anchor:
|
||||
pattern = "^" + pattern
|
||||
pattern = r"^\/?" + pattern # Allow an optional leading slash after the start of the string
|
||||
return pattern
|
||||
|
||||
def get_file_owners(file_path, codeowners_lines):
|
||||
|
||||
Reference in New Issue
Block a user