Skip to content

Commit 1960cdf

Browse files
authored
Merge pull request #34 from ONS-Innovation/fix_external_pr_check
KEH-818 | External PR Bug
2 parents 4c71a49 + 3ae5c96 commit 1960cdf

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

data_logger/src/policy_checks.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,23 @@ def has_external_pr(prs: list, org_members: list) -> bool:
6666
"""
6767

6868
for pr in prs:
69-
if pr["author"] not in org_members:
69+
# Check if the PR has an author
70+
# If not, the author of the PR is a deleted account
71+
# and the PR is not considered external
72+
# So we skip it
73+
author = pr.get("author")
74+
if not author:
75+
continue
76+
77+
login = author.get("login")
78+
if not login:
79+
continue
80+
81+
# Dependabot PRs are not considered external
82+
if login == "dependabot":
83+
continue
84+
85+
if login not in org_members:
7086
return True
7187

7288
return False

0 commit comments

Comments
 (0)