Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gittensor/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions gittensor/utils/github_api_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down