Skip to content

Add Pull Request management commands (Get, Set/Update, Comment, Close) #546

@MariusStorhaug

Description

@MariusStorhaug

Summary

The GitHub PowerShell module is currently missing commands for managing pull requests. These are needed for automation scenarios such as listing/filtering PRs, adding comments, and closing superseded PRs.

Missing commands

The following commands (or equivalents) would be valuable additions to the module:

Get-GitHubPullRequest

  • List/filter pull requests by state, head branch, base branch, etc.
  • Get a specific pull request by number.
  • Similar to GET /repos/{owner}/{repo}/pulls and GET /repos/{owner}/{repo}/pulls/{pull_number}.

New-GitHubPullRequestComment

  • Add a comment to a pull request (via the issues comments endpoint).
  • Similar to POST /repos/{owner}/{repo}/issues/{issue_number}/comments.

Set-GitHubPullRequest / Update-GitHubPullRequest

  • Update a pull request's state (e.g., close it), title, body, base branch, etc.
  • Similar to PATCH /repos/{owner}/{repo}/pulls/{pull_number}.

Use case

In the PSModule/GoogleFonts repository, an automated workflow updates font data and creates a PR. When a new Auto-Update PR is created, older Auto-Update PRs should be commented on (explaining they are superseded) and then closed. This requires the ability to:

  1. List open PRs filtered by head branch or title pattern
  2. Add a comment to a PR
  3. Close a PR by updating its state

Currently we work around this by using the gh CLI directly, but native PowerShell commands in the GitHub module would be preferred for consistency and better integration with the rest of the module.

Related

Metadata

Metadata

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions