mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[GH1] Ignore "COMMENTED" reviews
Do not use `lastestReviews` as indicator as to whether PR was reviewed or not, as "COMMENTED" PRs take precedence over "APPROVED" Instead, iterate over all reviews, which are in chronological order (newest one are at the bottom) and keep latest review from the author ignoring "COMMENTED" ones Pull Request resolved: https://github.com/pytorch/pytorch/pull/72751
This commit is contained in:
committed by
PyTorch MergeBot
parent
0c95209fe7
commit
ef92b5490b
15
.github/scripts/trymerge.py
vendored
15
.github/scripts/trymerge.py
vendored
@ -65,7 +65,7 @@ query ($owner: String!, $name: String!, $number: Int!) {
|
||||
path
|
||||
}
|
||||
}
|
||||
latestReviews(last: 100) {
|
||||
reviews(last: 100) {
|
||||
nodes {
|
||||
author {
|
||||
login
|
||||
@ -204,10 +204,17 @@ class GitHubPR:
|
||||
return rc
|
||||
|
||||
def _get_reviewers(self) -> List[Tuple[str, str]]:
|
||||
reviews_count = int(self.info["latestReviews"]["totalCount"])
|
||||
if len(self.info["latestReviews"]["nodes"]) != reviews_count:
|
||||
reviews_count = int(self.info["reviews"]["totalCount"])
|
||||
nodes = self.info["reviews"]["nodes"]
|
||||
if len(nodes) != reviews_count:
|
||||
raise RuntimeError("Can't fetch all PR reviews")
|
||||
return [(x["author"]["login"], x["state"]) for x in self.info["latestReviews"]["nodes"]]
|
||||
reviews = {}
|
||||
for node in nodes:
|
||||
author = node["author"]["login"]
|
||||
state = node["state"]
|
||||
if state != "COMMENTED":
|
||||
reviews[author] = state
|
||||
return list(reviews.items())
|
||||
|
||||
def get_approved_by(self) -> List[str]:
|
||||
return [login for (login, state) in self._get_reviewers() if state == "APPROVED"]
|
||||
|
Reference in New Issue
Block a user