Functions/New-GitHubIssue.ps1


function New-GitHubIssue {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory)] [string] $Title,
        [Parameter(Mandatory)] [ValidateSet("enhancement", "bug")] [string[]] $Labels,
        [Parameter()] [string] $Body = ""
    )

    if (!(Test-Path "C:\Program Files\GitHub CLI\gh.exe")) {
        throw "Github CLI not installed. Missing `"C:\Program Files\GitHub CLI\gh.exe`""
    }

    if (!(gh api /user)) {
        throw "Not logged in to GitHub"
    }

    # if (!(Test-Path ".git")) {
    # throw "not a git repository"
    # }


    gh issue create --label $Labels --title "$($Title)" --assignee '@me' --body $Body



}