Open jack89roberts opened 3 years ago
I've made a post about this in the community forum:
https://github.community/t/pagination-not-working-on-reactiongroups-reactors/192255
As far as I can tell pagination isn't working for these queries in the GraphQL API.
Script written by @mhauru to get reactions with PyGitHub:
"""Script for getting Github emojis for Hut23 issues.
Usage:
python3 -m pip install PyGithub
export GITHUB_TOKEN=generate-a-github-API-token-with-repo-rights-and-paste-it-here
python3 emojis.py some-issue-number maybe-another-issue-number
"""
from github import Github
import os
import sys
def main():
org_name = "alan-turing-institute"
repo_name = "Hut23"
token = os.environ["GITHUB_TOKEN"]
g = Github(token)
org = g.get_organization(org_name)
repo = org.get_repo(repo_name)
for issue_number in sys.argv[1:]:
issue_number = int(issue_number)
issue = repo.get_issue(issue_number)
print(f"# Issue: {issue.title} ({issue.number})")
# Initialising with the standard emojis here ensures that when listing
# results at the end these three come first, in this order, with all
# others at the end.
reaction_dict = {"laugh": [], "+1": [], "-1": []}
for r in issue.get_reactions():
emoji = r.content
if emoji not in reaction_dict:
reaction_dict[emoji] = []
# Use the display name, or login name if that doesn't exist.
name = r.user.name
if not name:
name = r.user.login
reaction_dict[emoji].append(name)
for k, v in reaction_dict.items():
print(f"Reaction: {k}, count: {len(v)}")
print(" ", end="")
for name in sorted(v):
print(name, end=", ")
print()
if __name__ == "__main__":
main()
Via James G: I think that Wimbledon reports at most 10 “thumbs down”, even when more than 10 people have thumbs-downed the project. Note that this is the same as the maximum number for which GitHub shows the name (after that, it just reports “and 3 more.“). See, eg, https://github.com/alan-turing-institute/Hut23/issues/979 and https://github.com/alan-turing-institute/Hut23/issues/845
The query is currently requesting up to 32 reactions per type, so this is a GitHub API issue/an issue with the way we're using the GitHub API. Incidentally I spotted that "users" in the API query is now deprecated and should be replaced with "reactors": https://docs.github.com/en/graphql/reference/objects#reactiongroup (users will be removed Oct 2021).