-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only count the users latest review #2
Only count the users latest review #2
Conversation
Oops, that won't work with later code. |
959cd34
to
459dc40
Compare
for review in p_r_reviews: | ||
if review.state == "APPROVED": | ||
approvals[review.user] = review | ||
last_approved_review_date = review.submitted_at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assumes the order of reviews is chronologically, which held true during my tests.
> label-approved
INFO:root:Pulls total: 8
INFO:root:Processing 176175
INFO:root:lastappdate: 2022-06-04 09:21:32
INFO:root:lastcommitdate: 2022-06-04 02:17:11
INFO:root:Removing label '12.approvals: 2' from PR: '176175' https://github.com/NixOS/nixpkgs/pull/176175
Traceback (most recent call last):
File "/nix/store/h8s1yi7jvxcb6kblamiy1d8kzni6p3p6-python3.10-poetry2nix-env-scripts/bin/.label-approved-wrapped", line 13, in <module>
sys.exit(main())
File "/nix/store/v7kl295wwqxgax6gm3zw95aq5zwcgbzg-source/src/label_approved/cli.py", line 156, in main
pr_object.p_r.remove_from_labels(label_to_remove)
File "/nix/store/01h3ndmfxlgf6hklk422alxdzcljadak-python3-3.10.3-env/lib/python3.10/site-packages/github/PullRequest.py", line 809, in remove_from_labels
headers, data = self._requester.requestJsonAndCheck(
File "/nix/store/01h3ndmfxlgf6hklk422alxdzcljadak-python3-3.10.3-env/lib/python3.10/site-packages/github/Requester.py", line 353, in requestJsonAndCheck
return self.__check(
File "/nix/store/01h3ndmfxlgf6hklk422alxdzcljadak-python3-3.10.3-env/lib/python3.10/site-packages/github/Requester.py", line 378, in __check
raise self.__createException(status, responseHeaders, output)
github.GithubException.GithubException: 403 {"message": "Must have admin rights to Repository.", "documentation_url": "https://docs.github.com/rest/reference/issues#remove-a-label-from-an-issue"} |
|
Fixes inflate review count due to a cycle of approve, comment/request changes, approve.
459dc40
to
3ee35bc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, i forgot to turn on notifications for all events in this repo
Foxes Inflated review count due to
as seen in NixOS/nixpkgs#176175
Untested