diff --git a/gittensor/classes.py b/gittensor/classes.py index 2d4a8401..419dbe82 100644 --- a/gittensor/classes.py +++ b/gittensor/classes.py @@ -274,7 +274,7 @@ def from_graphql_response(cls, pr_data: dict, uid: int, hotkey: str, github_id: hotkey=hotkey, github_id=github_id, title=pr_data['title'], - author_login=pr_data['author']['login'], + author_login=(pr_data.get('author') or {}).get('login', 'ghost'), merged_at=merged_at, created_at=parse_github_timestamp_to_cst(pr_data['createdAt']), pr_state=pr_state, diff --git a/gittensor/utils/github_api_tools.py b/gittensor/utils/github_api_tools.py index dedeadc6..c6393ad6 100644 --- a/gittensor/utils/github_api_tools.py +++ b/gittensor/utils/github_api_tools.py @@ -926,11 +926,12 @@ def should_skip_merged_pr( ) # Skip if PR was merged by the same person who created it (self-merge) AND there's no approvals from a differing party - if pr_raw['mergedBy'] and pr_raw['author']['login'] == pr_raw['mergedBy']['login']: + pr_author_login = (pr_raw.get('author') or {}).get('login', 'ghost') + if pr_raw['mergedBy'] and pr_author_login == pr_raw['mergedBy']['login']: # Check if there are any approvals from users other than the author reviews = pr_raw.get('reviews', {}).get('nodes', []) has_external_approval = any( - review.get('author') and review['author']['login'] != pr_raw['author']['login'] for review in reviews + review.get('author') and review['author']['login'] != pr_author_login for review in reviews ) if not has_external_approval: