-
Notifications
You must be signed in to change notification settings - Fork 43
Enable preview deployments and PR comments in docs-preview-local #3297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
cat .github/workflows/docs-preview-local.yml | wc -lRepository: elastic/docs-builder
Length of output: 68
🏁 Script executed:
sed -n '420,460p' .github/workflows/docs-preview-local.ymlRepository: elastic/docs-builder
Length of output: 1297
🏁 Script executed:
Repository: elastic/docs-builder
Length of output: 2169
🌐 Web query:
GitHub Actions@actions/githubpaginate listComments API documentation💡 Result:
@actions/github“paginate” for listComments: use Octokit pagination (Link-header driven) on the REST endpoint that lists issue comments (issues/{issue_number}/comments). The REST endpoint supports pagination via the page and per_page query parameters (max 100) and also supports since filtering; GitHub paginates results using the response Link header when there are more results. [1][2][3] In GitHub Actions, the@actions/githubpackage provides a hydrated Octokit client (github.getOctokit / octokit.rest.*). [4] Use octokit.paginate with the list-comments endpoint so it automatically fetches all pages until the last page, returning a single array of items. [2][3] Example (actions/github-script / Node JS): const comments = await github.paginate(github.rest.issues.listComments, { owner: context.repo.owner, repo: context.repo.repo, issue_number: 123, per_page: 100, }); This pattern is also used in the official actions/github-script discussion as the fix when listComments exceeds the single-page default of 30. [5] Key REST details for listComments / issue comments: - Endpoint: GET /repos/{owner}/{repo}/issues/{issue_number}/comments [1] - Pagination query parameters: page (default 1), per_page (default 30, max 100) [1] Octokit pagination mechanics: - GitHub Docs’ pagination guide states that Octokit’s paginate fetches next pages until the last page and returns all items as a single array. [3]Citations:
🌐 Web query:
@actions/github github.paginate method documentation💡 Result:
In GitHub Actions,
@actions/githubexposes an authenticated Octokit client and supports pagination via octokit.paginate (and related iterator helpers) when using the underlying Octokit REST pagination plugin. What documentation exists for github.paginate / octokit.paginate 1) Official GitHub REST API pagination docs (Octokit integration) GitHub documents that for paginated REST API results you can use octokit.paginate, which fetches the next page until the last page and returns all items as a single array; it also supports a map function and octokit.paginate.iterator to iterate page-by-page. [1][2] 2) Authoritative Octokit plugin documentation:@octokit/plugin-paginate-restThe plugin-paginate-rest package documentation states that it adds octokit.paginate which accepts the same parameters as octokit.request; it wraps octokit.request and continues requesting while there is a rel="next" link in the response Link header. It also notes only “List...” endpoints are supported for pagination and that non-list endpoints behave like octokit.request. [3] What the method does (high-confidence behavior) - octokit.paginate wraps octokit.request and keeps requesting the “next” URL as long as the response Link header contains rel="next". [3] - It returns all fetched items as a single array (even when the underlying raw REST result was an object, octokit.paginate returns an array of items). [1][2] - You can supply a map function to process each page’s results and optionally end early by calling done. [1] - Alternatively, octokit.paginate.iterator lets you iterate one page/response at a time, more memory-efficient than collecting everything. [1] How this maps to@actions/github-@actions/githubis a hydrated Octokit client returned by getOctokit(token). [4][5] - As part of the standard usage, the client retains pagination APIs (github.paginate) consistent with Octokit.js (used in github-script examples). For example, actions/github-script shows calling await github.paginate(opts) to get all pages of a REST list endpoint. [6] Practical example pattern (from official docs) - For REST: use octokit.paginate with the REST “list” endpoint route/params, and optionally map. GitHub’s docs explicitly recommend octokit.paginate for fetching paginated results via Octokit.js. [1] If you meant pagination for GraphQL - There is a separate plugin for GraphQL pagination: octokit.graphql.paginate, which paginates by scanning for pageInfo and using endCursor when hasNextPage is true. [7] Most relevant references to read - GitHub Docs: “Using pagination in the REST API” (Octokit.paginate + iterator + map function). [1][2] - Octokit plugin:@octokit/plugin-paginate-rest.js(how octokit.paginate is implemented via Link header rel="next"). [3] -@actions/githubpackage overview (shows it returns an authenticated Octokit client and is how Actions code gets an Octokit instance). [4][5]Citations:
Fetch all comment pages to avoid duplicates and strict bot identity match.
This only fetches the first page (~30 comments) and matches any bot. On busy PRs, it misses the existing comment, creating duplicates. Use
github.paginate()to fetch all pages and match specifically againstgithub-actions[bot]to avoid accidentally updating other bots' comments.Proposed fix
🤖 Prompt for AI Agents