When using some APIs to list the objects we want to view, such as “List repository tags”, “List commits on a pull request”, “List workflow runs for a repository”, etc., generally we can see the following two parameters are mentioned to be available to these APIs:
Name | Type | In | Description |
---|---|---|---|
per_page | integer | query | Results per page (max 100) |
page | integer | query | Page number of the results to fetch. |
Accourding to my understanding, for example, I have 208 workflow runs in one of my repository, and I execute the API like as below:
https://api.github.com/repos/owner/repo/actions/runs?per_page=100&page=<page_number>
-
when set page=1, the API return 100 runs.
https://api.github.com/repos/owner/repo/actions/runs?per_page=100&page=1
result:
{ "total_count": 208, "workflow_runs": [ --- list 100 runs --- ] }
-
when set page=2, the API should return another 100 runs.
https://api.github.com/repos/owner/repo/actions/runs?per_page=100&page=2
result:
{ "total_count": 208, "workflow_runs": [ --- list another 100 runs --- ] }
-
when set page=3, the API should return the rest 8 runs.
https://api.github.com/repos/owner/repo/actions/runs?per_page=100&page=3
result:
{ "total_count": 208, "workflow_runs": [ --- list the rest 8 runs --- ] }
-
when set page=4 (or large than 4), the API should return an empty array (length=0).
https://api.github.com/repos/owner/repo/actions/runs?per_page=100&page=4
result:
{ "total_count": 208, "workflow_runs": [] }
When I execute the API on Postman, it can correctly display the runs in each page, just likes as I mentioned above.
But when I execute the API in the shell scripts (Bash), it can’t correctly display in each page. No matter what page number I set, it always returns 100 runs in each page. This looks like a bug for the API.