Skip to content

Commit 5d1436e

Browse files
authored
Merge pull request #8 from 5an7y/sample-based-issue-template
Made the query more efficient
2 parents ba50875 + 4c463c3 commit 5d1436e

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

.github/workflows/tag-codeowner-on-issue.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
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']

0 commit comments

Comments
 (0)