Skip to content

🚀 [Feature]: Pull requests can now be listed, updated, and commented on - #547

Draft
Marius Storhaug (MariusStorhaug) with Copilot wants to merge 4 commits into
mainfrom
copilot/add-pull-request-management-commands
Draft

🚀 [Feature]: Pull requests can now be listed, updated, and commented on#547
Marius Storhaug (MariusStorhaug) with Copilot wants to merge 4 commits into
mainfrom
copilot/add-pull-request-management-commands

Conversation

CopilotAI commented Feb 9, 2026

Copy link
Copy Markdown
Contributor

Pull requests in a repository can now be listed, filtered, retrieved by number, updated, and commented on directly from PowerShell. This removes the need to shell out to the gh CLI for pull request automation scenarios such as closing superseded auto-update PRs.

New: List and retrieve pull requests

Get-GitHubPullRequest lists pull requests in a repository with optional filtering by state, head branch, base branch, sort order, and direction. A specific pull request can also be retrieved by number.

# List all open pull requestsGet-GitHubPullRequest-Owner 'PSModule'-Repository 'GitHub'# Filter by state and head branchGet-GitHubPullRequest-Owner 'PSModule'-Repository 'GoogleFonts'-State 'open'-Head 'PSModule:auto-update'# Get a specific pull request by numberGet-GitHubPullRequest-Owner 'PSModule'-Repository 'GitHub'-Number 123

New: Update pull request state, title, and body

Update-GitHubPullRequest modifies a pull request's title, body, state (open/closed), base branch, or maintainer modification flag. Supports pipeline input from Get-GitHubPullRequest.

# Close a pull requestUpdate-GitHubPullRequest-Owner 'PSModule'-Repository 'GitHub'-Number 123-State 'closed'# Close all PRs from a specific branch via pipelineGet-GitHubPullRequest-Owner 'PSModule'-Repository 'GoogleFonts'-Head 'PSModule:auto-update'|Update-GitHubPullRequest-State 'closed'

New: Comment on pull requests

New-GitHubPullRequestComment adds a comment to a pull request via the Issues API (since PRs are issues in the GitHub API). Supports pipeline input.

# Add a comment to a pull requestNew-GitHubPullRequestComment-Owner 'PSModule'-Repository 'GitHub'-Number 123-Body 'Superseded by newer PR'# Comment on multiple PRs via pipelineGet-GitHubPullRequest-Owner 'PSModule'-Repository 'GoogleFonts'-Head 'PSModule:auto-update'|New-GitHubPullRequestComment-Body 'This PR has been superseded.'

Technical Details

  • GitHubPullRequest class extends GitHubNode, mapping REST API fields to PascalCase properties. Includes null-safe handling for deleted fork repositories in head/base repo references.
  • Private functions in src/functions/private/PullRequests/: Get-GitHubPullRequestList (GET /repos/{owner}/{repo}/pulls), Get-GitHubPullRequestByNumber (GET /repos/{owner}/{repo}/pulls/{pull_number}), Update-GitHubPullRequestByNumber (PATCH /repos/{owner}/{repo}/pulls/{pull_number}), New-GitHubPullRequestCommentByNumber (POST /repos/{owner}/{repo}/issues/{issue_number}/comments).
  • Public functions follow the standard module pattern: filter keyword, Resolve-GitHubContext in begin block, switch on $PSCmdlet.ParameterSetName for routing.
  • Update-GitHubPullRequest and New-GitHubPullRequestComment use SupportsShouldProcess.
  • Tests validate listing PRs on an empty repository. Full CRUD tests require branch/commit setup and are noted as future work.
  • Endpoints not covered in this PR (future work): Create PR, Merge PR, List PR commits/files, Check merged status, Update PR branch.

CopilotAIand others added 3 commits February 9, 2026 09:50
- Add GitHubPullRequest class
- Add Get-GitHubPullRequest command (list and get by number)
- Add Update-GitHubPullRequest command (close, update title, body, etc.)
- Add New-GitHubPullRequestComment command (add comments to PRs)
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
- Use $Owner and $Repository instead of $OwnerName/$RepositoryName
- Add examples demonstrating PR management use cases
- Fix linter issues
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
- Add null checks for head/base repository properties
- Write errors to error stream when PR not found
- Address code review feedback
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
CopilotAI changed the title [WIP] Add pull request management commands for automationAdd Pull Request management commandsFeb 9, 2026
@MariusStorhaugMarius Storhaug (MariusStorhaug) changed the title Add Pull Request management commands🚀 [Feature]: Pull requests can now be listed, updated, and commented onApr 4, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

No open projects
Status: Todo

Development

Successfully merging this pull request may close these issues.

Add Get, Update, and Comment commands for pull requests

2 participants

@MariusStorhaug