Skip to content

Modify PRs as Issues #333

Open
Open
@andyleejordan

Description

@andyleejordan

Feature Idea Summary

Hello,

According to the GitHub API Documentation

Every pull request is an issue, but not every issue is a pull request. For this reason, "shared" actions for both features, like manipulating assignees, labels and milestones, are provided within the Issues API.

Take, for example, adding a Label to a PR. This module currently has no direct cmdlet to do so, that is, there's no Add-GitHubPRLabel. There is, of course, Add-GitHubIssueLabel. This cmdlet works with PRs, but only in a hacky way (take the PullRequestNumber field of a PullRequest object and supply it to Add-GitHubIssueLabel as the value for the -Issue parameter. Instead, all Issue cmdlets in this module should support PRs: that is, a PR object when pipelined to an Issue cmdlet should be treated just like an issue.

Feature Idea Additional Details

Here's the current hacky way to add a label to a PR (and please correct me if I'm wrong!), assuming $Repo is a Repo object and @Params is an adequate set of params for New-GitHubPullRequest:

$PR = $Repo | New-GitHubPullRequest @Params
$Repo | Add-GitHubIssueLabel -Issue $PR.PullRequestNumber -LabelName "SomeCoolLabel"

When instead it should just be:

$PR | Add-GitHubIssueLabel -LabelName "SomeCoolLabel"

I imagine based on my cusory browsing of the module's implementation that we could add some filter that turns a PR object into an Issue object, and then modify every Issue cmdlet to do that for PRs, or something to that effect.

Requested Assignment

  • I'm just suggesting this idea, but don't want to implement it (probably).

Operating System

Name                           Value
----                           -----
OSVersion                      Unix 11.0.0
Is 64-bit                      True
Current culture                en-US
Current UI culture             en-US

PowerShell Version

Name                           Value
----                           -----
PSVersion                      7.1.3
PSEdition                      Core
GitCommitId                    7.1.3
OS                             Darwin 20.5.0 Darwin Kernel Version 20.5.0: Sat…
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module Version

Running: 
Installed: 0.16.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAn issue or pull request introducing new functionality to the project.triage neededAn issue that needs to be reviewed by a member of the team.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions