Skip to content

Add optional username filtering to PR comments#51

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/improve-pr-comments-solution
Draft

Add optional username filtering to PR comments#51
Copilot wants to merge 4 commits into
mainfrom
copilot/improve-pr-comments-solution

Conversation

Copilot AI commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

The get-pr-comments solution now supports optional username filtering. When no username is provided, all comments are returned. When a username is specified, only comments from that user are included.

Changes

  • API signature: Added optional username parameter to fetchPRComments(owner, repo, prNumber, username?, token?)
  • Filtering: Filters both issue comments and review comments by user.login when username is provided
  • CLI: Accepts optional 4th argument: get-pr-comments <owner> <repo> <prNumber> [username]
  • Warning context: Displays username-specific warning when filtering without authentication token

Usage

// Get all comments (existing behavior)
const all = await fetchPRComments('owner', 'repo', 123);

// Filter by username
const filtered = await fetchPRComments('owner', 'repo', 123, 'copilot');

// With auth token
const filtered = await fetchPRComments('owner', 'repo', 123, 'copilot', token);

Note: Parameter order places username before token for more natural optional parameter progression.

Original prompt

This section details on the original issue you should resolve

<issue_title>Improve solution for PR comments to get all comments on PR</issue_title>
<issue_description>Improve the PR comments solution so that the username on a PR is optional. By default, it gets all comments on a PR. </issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits January 29, 2026 15:38
Co-authored-by: dfberry <1517008+dfberry@users.noreply.github.com>
Co-authored-by: dfberry <1517008+dfberry@users.noreply.github.com>
Co-authored-by: dfberry <1517008+dfberry@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve solution for PR comments to handle optional username Add optional username filtering to PR comments Jan 29, 2026
Copilot AI requested a review from dfberry January 29, 2026 15:47
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.

Improve solution for PR comments to get all comments on PR

2 participants