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