Skip to content

Add GraphQL pagination via @octokit/plugin-paginate-graphql - #729

Open
KR-Ravindra wants to merge 1 commit into
actions:mainfrom
KR-Ravindra:feat/graphql-paginate
Open

Add GraphQL pagination via @octokit/plugin-paginate-graphql#729
KR-Ravindra wants to merge 1 commit into
actions:mainfrom
KR-Ravindra:feat/graphql-paginate

Conversation

@KR-Ravindra

Copy link
Copy Markdown

Problem

github.paginate handles REST pagination, but scripts that page GraphQL results still have to hand-roll cursor loops. #309 asks to include @octokit/plugin-paginate-graphql by default so github.graphql.paginate works like the REST helper does.

Fix

  • Add @octokit/plugin-paginate-graphql ^6.0.0 (peer @octokit/core >=6, compatible with the v7 core already in use) as a dependency.
  • src/main.ts adds paginateGraphQL to the plugin list of both the pre-built github client and createConfiguredGetOctokit, so secondary clients from the injected getOctokit also get graphql.paginate / graphql.paginate.iterator.
  • README: new "Paginate GraphQL queries" example next to the existing GraphQL example; .licenses/ cache entry for the new package (as done for plugin-request-log); dist/ rebuilt with npm run build.

How tested

  • New __test__/main.test.ts loads src/main.ts with inputs set through INPUT_* env vars and stand-ins for the ESM-only @actions/github / Octokit plugin packages (the CommonJS Jest runtime cannot load them, which is why the existing tests avoid them too). It asserts the primary client and a secondary getOctokit client are both built with retry, requestLog, paginateGraphQL.
    • Before (upstream main.ts): both assertions fail, getOctokit received only retry, requestLog.
    • After: 5 suites, 37 tests pass; npm run style:check clean.
  • New integration.yml job test-graphql-paginate walks two pages of issues with github.graphql.paginate.iterator against the real API and checks both github and a getOctokit secondary client expose graphql.paginate.
  • Ran the rebuilt dist/index.js locally with a dummy token: typeof github.graphql.paginate and typeof getOctokit('t').graphql.paginate both return function; the previous build fails with Cannot read properties of undefined (reading 'iterator').

Links

This change was prepared with an AI agent operated by KR-Ravindra, who reviewed and tested it.

Include the paginate-graphql Octokit plugin by default so scripts can
call github.graphql.paginate / github.graphql.paginate.iterator instead
of hand-rolling cursor loops, mirroring github.paginate for REST.

The plugin is added to both the pre-built github client and the
secondary clients created through the injected getOctokit. Adds a
README example, a licensed cache entry, an integration job, and
rebuilds dist/.

Refs actions#309
@KR-Ravindra

Copy link
Copy Markdown
Author

Round 1 self-review.

  1. `npm run build` on this branch produces no `dist/` diff, so Check dist/ should pass once workflows are approved.
  2. The two new `main.test.ts` assertions fail against upstream `src/main.ts` (getOctokit receives only `retry, requestLog`) and pass here.
  3. Ran the built `dist/index.js` with a dummy token: `github.graphql.paginate`, `.paginate.iterator` and `getOctokit('t').graphql.paginate` are all functions; the current release returns `undefined` for each.
  4. The `.licenses` entry was written following `plugin-request-log.dep.yml`; the Licensed job will confirm it.
  5. Follow-up I will take if reviewers want it: an `afterAll` in `main.test.ts` to clear the `INPUT_*` env vars and `non_webpack_require` global it sets.

Marking ready; all workflows are waiting on first-contributor approval.

@KR-Ravindra
KR-Ravindra marked this pull request as ready for review September 13, 2026 09:05
@KR-Ravindra
KR-Ravindra requested a review from a team as a code owner September 13, 2026 09:05
Copilot AI lite review requested due to automatic review settings September 13, 2026 09:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants