Skip to content
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

Modify PRs as Issues #333

Open
andyleejordan opened this issue Jul 15, 2021 · 1 comment
Open

Modify PRs as Issues #333

andyleejordan opened this issue Jul 15, 2021 · 1 comment
Labels
enhancement An issue or pull request introducing new functionality to the project. triage needed An issue that needs to be reviewed by a member of the team.

Comments

@andyleejordan
Copy link
Member

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
@andyleejordan andyleejordan added enhancement An issue or pull request introducing new functionality to the project. triage needed An issue that needs to be reviewed by a member of the team. labels Jul 15, 2021
@HowardWolosky
Copy link
Member

Hi @andschwa -- I appreciate the suggestion.
I've actually completed most of the work to properly support the pull requests API's last year (see here). The work got side-tracked when I started tackling larger scale issues (like pipelining and function consistency) and I haven't found the time to revisit and complete it, but I'm hoping to do so in the near future. At this point, the remaining work (I think) is to update it to support pipelining (as it was implemented before this module had pipeline support) and add tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An issue or pull request introducing new functionality to the project. triage needed An issue that needs to be reviewed by a member of the team.
Projects
None yet
Development

No branches or pull requests

2 participants