Skip to content
Latchkey

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 hundreds

Common 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

  1. Use github.paginate.iterator(...) to stream pages for large result sets.
  2. Always set per_page: 100 to minimize round trips.
  3. 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →