microsoft / PowerShellForGitHub

Microsoft PowerShell wrapper for GitHub API
Other
588 stars 185 forks source link

Is there platform independent PS module build to top of this one? #340

Closed olljanat closed 2 years ago

olljanat commented 3 years ago

We are planning migration from classic pipelines to YAML pipelines and we know that on sometime in future we will most probably migrate to GitHub Enterprise too so I ended up thinking that it would make sense to create PS module where commands are same no matter what is underlying platform (PSGit on examples below).

I mean on way that would just login to Azure DevOps with command like:

$splat = @{
    Platform            = "AzureDevOps"
    GitRepo             = 'myRepo'
    Collection          = 'myCollection'
    Project             = 'myProject'
    Instance            = 'https://dev.azure.com/'
    PersonalAccessToken = 'myPersonalAccessToken'
}
New-PSGitSession @splat

and PSGit module would then use AzurePipelinesPS.

Or alternatively I would be able to login to GitHub Enterprise with command like:

$splat = @{
    Platform            = "GitHub"
    GitRepo             = 'myRepo'
    PersonalAccessToken = 'myPersonalAccessToken'
    Instance            = "github.contoso.com"
}
New-PSGitSession @splat

and PSGit module would then use PowerShellForGitHub.

But on both cases user would be able to use commands like:

New-PSGitPullRequest -SourceBranch "feat/new-ui" -TargetBranch "main" -Title "New UI"

and that it should be open source tool where community can add support for more platforms too.

Also asked same question from https://github.com/Dejulia489/AzurePipelinesPS/issues/22

olljanat commented 3 years ago

FYI. I started to piloting that concept on https://github.com/olljanat/PSGit

HowardWolosky commented 2 years ago

@olljanat - Apologies for the late response -- I completely missed this Issue when you opened it...only saw the notification when it got closed.

I'm confused by the question though, because this module is platform independent. Any script that you write with it will work consistently across Mac, Linux and Windows (in both Windows PowerShell and PowerShell 7+).

olljanat commented 2 years ago

@HowardWolosky Ah, "platform" is probably bad word selection. I was meaning more like generic PS module which works with both Azure DevOps and GitHub (and maybe others too) with same cmdlets.

Examples my on my pilot project https://github.com/olljanat/PSGit#usage probably clarify what I mean. Main idea is that I can build automation on top of Azure DevOps which does not need to be refactored if/when we decide switch to GitHub Enterprise as most probably some point in future we need to do that switch.

HowardWolosky commented 2 years ago

Now I understand what you're getting at. I think that's an interesting idea, but definitely out-of-scope for this project. I wish you luck with your efforts though -- be sure to come back here and report how things are going if you make further progress.