diff options
| author | 5an7y <[email protected]> | 2025-07-14 10:22:08 -0700 |
|---|---|---|
| committer | 5an7y <[email protected]> | 2025-07-14 10:22:08 -0700 |
| commit | 4c463c36efa37f9e5ab5acaec52e153abc090dcb (patch) | |
| tree | adbb8df2ae1a688d47e2cfd2d672948e1e7022b8 | |
| parent | e48795a8b2636a44689a02d8664050678f6ae256 (diff) | |
Made the query more efficient
| -rw-r--r-- | .github/workflows/tag-codeowner-on-issue.yml | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/.github/workflows/tag-codeowner-on-issue.yml b/.github/workflows/tag-codeowner-on-issue.yml index 088500d7..eb9c0523 100644 --- a/.github/workflows/tag-codeowner-on-issue.yml +++ b/.github/workflows/tag-codeowner-on-issue.yml @@ -46,7 +46,7 @@ jobs: with open(".github/CODEOWNERS", "r") as f: lines = f.readlines() - codeowners = {} + codeowner = None sample_section = False for line in lines: line = line.strip() @@ -57,15 +57,16 @@ jobs: if line.startswith("#") or not line: continue path, owner = line.split() - codeowners[path] = owner + if path == selected_path: + codeowner = owner + break - owner = codeowners.get(selected_path) - if not owner: + if codeowner is None: print(f"No codeowner found for path: {selected_path}") exit(0) # Post a comment tagging the owner - comment = f"{owner} can you please take a look at this issue related to `{selected_path}`?" + comment = f"{codeowner} can you please take a look at this issue related to `{selected_path}`?" issue_number = os.environ['GITHUB_REF'].split('/')[-1] repo = os.environ['GITHUB_REPOSITORY'] token = os.environ['GITHUB_TOKEN'] |
