agithub icon indicating copy to clipboard operation
agithub copied to clipboard

Github pagination does not operate if the response is not a list, such as in the list-workflow-runs API

Open joshzana opened this issue 4 years ago • 0 comments

The List workflow runs GitHub API returns an object with a nested list. It also returns the standard GitHub link headers to support pagination.

With the following code, no pagination occurs:

    github_client = GitHub(token=GITHUB_TOKEN, paginate=True)
    status, data = github_client.repos.falkonai.server.actions.workflows[
        "<workflow_name>"
    ].runs.get()

I believe the issue is this check in the Github request method:

if self.paginate and type(data) == list:

Since data is a dict here. I don't know why Github chose to make this API return an object instead of a list.

joshzana avatar Mar 24 '20 17:03 joshzana