File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4646 with open(".github/CODEOWNERS", "r") as f:
4747 lines = f.readlines()
4848
49- codeowners = {}
49+ codeowner = None
5050 sample_section = False
5151 for line in lines:
5252 line = line.strip()
@@ -57,15 +57,16 @@ jobs:
5757 if line.startswith("#") or not line:
5858 continue
5959 path, owner = line.split()
60- codeowners[path] = owner
60+ if path == selected_path:
61+ codeowner = owner
62+ break
6163
62- owner = codeowners.get(selected_path)
63- if not owner:
64+ if codeowner is None:
6465 print(f"No codeowner found for path: {selected_path}")
6566 exit(0)
6667
6768 # Post a comment tagging the owner
68- comment = f"{owner } can you please take a look at this issue related to `{selected_path}`?"
69+ comment = f"{codeowner } can you please take a look at this issue related to `{selected_path}`?"
6970 issue_number = os.environ['GITHUB_REF'].split('/')[-1]
7071 repo = os.environ['GITHUB_REPOSITORY']
7172 token = os.environ['GITHUB_TOKEN']
You can’t perform that action at this time.
0 commit comments