GitHub Actions actions/github-script Returns Only the First Page
A github-script call that lists issues, PRs, or files returns only the first page (about 30 items) because the REST endpoint is paginated. You must paginate to get the full set.
What this error means
A github-script step processes far fewer items than exist - typically capped near 30 or 100 - because it called a list endpoint once instead of paginating through all pages.
github-script
// only the first page
const { data } = await github.rest.issues.listForRepo({ owner, repo });
return data.length; // ~30, even if there are hundredsCommon causes
List endpoints are paginated
A single REST call returns one page (default per_page 30, max 100). Without pagination you only ever see that first page.
per_page raised but still capped
Bumping per_page to 100 helps but still truncates at 100. Anything larger needs real pagination across pages.
How to fix it
Use octokit.paginate
github.paginate fetches and concatenates every page for a paginated endpoint.
.github/workflows/ci.yml
- uses: actions/github-script@v7
with:
script: |
const all = await github.paginate(
github.rest.issues.listForRepo,
{ owner: context.repo.owner, repo: context.repo.repo, per_page: 100 }
);
core.info(`total: ${all.length}`);Or iterate page by page
- Use github.paginate.iterator(...) to stream pages for large result sets.
- Always set per_page: 100 to minimize round trips.
- Watch the rate limit when paginating very large repositories.
How to prevent it
- Always paginate list endpoints in github-script.
- Set per_page: 100 and use github.paginate for full results.
- Stream with paginate.iterator for very large datasets.
Related guides
GitHub Actions github-script "secondary rate limit" / 403 Abuse DetectionFix actions/github-script hitting a secondary rate limit - too many rapid API writes trigger 403 abuse detect…
GitHub Actions Composite Action Outputs Empty in the CallerFix GitHub Actions composite action outputs that arrive empty - outputs must be mapped in action.yml from a s…
GitHub Actions GITHUB_TOKEN Read-Only by Default - Write Calls 403Fix GitHub Actions 403s when the repo default GITHUB_TOKEN permission is read-only - set workflow permissions…