diff --git a/bot/kodiak/queries/__init__.py b/bot/kodiak/queries/__init__.py index b1b8d6ade..9e45067c1 100644 --- a/bot/kodiak/queries/__init__.py +++ b/bot/kodiak/queries/__init__.py @@ -505,7 +505,6 @@ class PRReviewAuthorSchema(BaseModel): @dataclass class PRReviewAuthor: login: str - permission: Permission class PRReviewSchema(BaseModel): @@ -555,17 +554,6 @@ class CheckRun(BaseModel): conclusion: Optional[CheckConclusionState] -class Permission(Enum): - """ - https://developer.github.com/v3/repos/collaborators/#review-a-users-permission-level - """ - - ADMIN = "admin" - WRITE = "write" - READ = "read" - NONE = "none" - - class TokenResponse(BaseModel): token: str expires_at: datetime @@ -922,7 +910,7 @@ async def get_api_features(self) -> ApiFeatures | None: ) return _api_features_cache - async def get_bot_reviews(self, *, reviews: List[PRReviewSchema]) -> List[PRReview]: + def get_bot_reviews(self, *, reviews: List[PRReviewSchema]) -> List[PRReview]: bot_reviews: List[PRReview] = [] for review in reviews: if not review.author: @@ -935,9 +923,7 @@ async def get_bot_reviews(self, *, reviews: List[PRReviewSchema]) -> List[PRRevi PRReview( state=review.state, createdAt=review.createdAt, - author=PRReviewAuthor( - login=review.author.login, permission=Permission.WRITE - ), + author=PRReviewAuthor(login=review.author.login), ) ) @@ -1068,8 +1054,8 @@ async def get_event_info(self, pr_number: int) -> Optional[EventInfoResponse]: repo=repository, ref_name=pr.baseRefName ) - partial_reviews = get_reviews(pr=pull_request) - bot_reviews = await self.get_bot_reviews(reviews=partial_reviews) + all_reviews = get_reviews(pr=pull_request) + bot_reviews = self.get_bot_reviews(reviews=all_reviews) return EventInfoResponse( config=cfg.parsed, config_str=cfg.text, diff --git a/bot/kodiak/test_evaluation.py b/bot/kodiak/test_evaluation.py index b6b532b6a..30df987d3 100644 --- a/bot/kodiak/test_evaluation.py +++ b/bot/kodiak/test_evaluation.py @@ -21,7 +21,6 @@ MergeableState, MergeStateStatus, NodeListPushAllowance, - Permission, PRReview, PRReviewAuthor, PRReviewRequest, @@ -271,7 +270,7 @@ def create_review() -> PRReview: return PRReview( state=PRReviewState.APPROVED, createdAt=datetime(2015, 5, 25), - author=PRReviewAuthor(login="ghost", permission=Permission.WRITE), + author=PRReviewAuthor(login="ghost"), ) diff --git a/bot/kodiak/test_queries.py b/bot/kodiak/test_queries.py index 6b3bafed3..a546ac417 100644 --- a/bot/kodiak/test_queries.py +++ b/bot/kodiak/test_queries.py @@ -21,7 +21,6 @@ MergeableState, MergeStateStatus, NodeListPushAllowance, - Permission, PRReview, PRReviewAuthor, PRReviewRequest, @@ -202,7 +201,7 @@ def block_event() -> EventInfoResponse: PRReview( createdAt=datetime.fromisoformat("2019-05-24T10:21:32+00:00"), state=PRReviewState.APPROVED, - author=PRReviewAuthor(login="kodiakhq", permission=Permission.WRITE), + author=PRReviewAuthor(login="kodiakhq"), ), ], status_contexts=[