X-Git-Url: https://apps.delaporte.us/gitweb/dotfiles.git/blobdiff_plain/3000302e7e283507dd67e77f6931d602e186e866..d182fb2cf69c77df54912299bd3bf1e3f48d10c8:/psmodules/edgithub.psm1?ds=sidebyside diff --git a/psmodules/edgithub.psm1 b/psmodules/edgithub.psm1 index 949974e..f24fcfa 100644 --- a/psmodules/edgithub.psm1 +++ b/psmodules/edgithub.psm1 @@ -3,13 +3,20 @@ Fetch closed GitHub issues that were updated in the last 14 days. +.NOTES + +Thism modules requires the following in your PowerShell profile: +$env:GITHUB_USERNAME = 'github_username' +$env:GITHUB_ORG = 'github_organization_name' +$env:GITHUB_REPOS = @('repository1', 'repository2', 'repository3') + #> function Get-GHClosed { param( [int]$days = -14 ) - $repos = @('SecOps-Tools', 'secdev-job-aids', 'awscli-login') - $issueSearchParams = @{ State = 'closed'; OwnerName = 'techservicesillinois' } + $repos = $env:GITHUB_REPOS.split(" ") + $issueSearchParams = @{ State = 'closed'; OwnerName = $env:GITHUB_ORG } $closed = @() $repos | ForEach-Object { $closed += Get-GitHubIssue -RepositoryName $_ @issueSearchParams @@ -31,8 +38,8 @@ function Get-GHToDiscuss { param( [int]$days = -14 ) - $repos = @('SecOps-Tools', 'secdev-job-aids', 'awscli-login') - $issueSearchParams = @{ State = 'open'; OwnerName = 'techservicesillinois' } + $repos = $env:GITHUB_REPOS.split(" ") + $issueSearchParams = @{ State = 'open'; OwnerName = $env:GITHUB_ORG } $closed = @() $repos | ForEach-Object { $closed += Get-GitHubIssue -RepositoryName $_ @issueSearchParams @@ -68,8 +75,9 @@ Fetch GitHub issues I am working on. #> function Get-GHMine() { - $repos = @('SecOps-Tools', 'secdev-job-aids', 'awscli-login') - $issueSearchParams = @{ Assignee = 'edthedev'; State = 'open'; OwnerName = 'techservicesillinois' } + $repos = $env:GITHUB_REPOS.split(" ") + $issueSearchParams = @{ Assignee = $env:GITHUB_USERNAME; + State = 'open'; OwnerName = $env:GITHUB_ORG } $issues = @() $repos | ForEach-Object { $issues += Get-GitHubIssue -RepositoryName $_ @issueSearchParams @@ -95,13 +103,18 @@ function Show-GHMine() { } <# +.SYNOPSIS + +Get GitHub issues that need sized. -Target GitHub search: +.DESCRIPTION + +Runs this GitHub search: is:open is:issue -label:M -label:L -label:S -label:XL -label:XS #> function Get-GHUnsized() { - $repos = @('SecOps-Tools', 'secdev-job-aids', 'awscli-login') + $repos = $env:GITHUB_REPOS.split(" ") $issueSearchParams = @{ State = 'open'; OwnerName = 'techservicesillinois' } $issues = @() $repos | ForEach-Object { @@ -118,6 +131,31 @@ function Get-GHUnsized() { return $issues } +function Get-GHNoMilestone() { + param( + [string]$repository + ) + $repos = $env:GITHUB_REPOS.split(" ") + if($repository){ + $repos = @($repository) + } + $issueSearchParams = @{ State = 'open'; OwnerName = 'techservicesillinois' } + $issues = @() + $repos | ForEach-Object { + $issues += Get-GitHubIssue -RepositoryName $_ @issueSearchParams + } + + # Get open issues with empty milestone + $issues = $issues | Where-Object { $null -eq $_.milestone } + return $issues +} +function Show-GHNoMilestone(){ + param( + [string]$repository + ) + Get-GHNoMilestone -Repository $repository | Show-GHIssuesAsMarkdown +} + function Show-GHUnsized() { Get-GHUnsized | ForEach-Object { # Markdown output @@ -125,6 +163,21 @@ function Show-GHUnsized() { } } +function Show-GHByAssignee() { + $repos = $env:GITHUB_REPOS.split(" ") + $issueSearchParams = @{ State = 'open'; OwnerName = 'techservicesillinois' } + $issues = @() + $repos | ForEach-Object { + $issues += Get-GitHubIssue -RepositoryName $_ @issueSearchParams + } + + # TODO: Group output by assignee. + + return $issues +} + + + function Show-GHToDiscuss() { Get-GHToDiscuss | Show-GHIssuesAsMarkdown } @@ -134,7 +187,7 @@ function Show-GHIssuesAsMarkdown() { process { # Markdown output - " + [" + $_.Title + " (" + $_.Number + ")](" + $_.html_url + ")" + $_.labels + " + [" + $_.Title + " (" + $_.Number + ")](" + $_.html_url + ")" } } @@ -145,4 +198,6 @@ Export-ModuleMember -Function Get-GHMine Export-ModuleMember -Function Show-GHMine Export-ModuleMember -Function Get-GHUnsized Export-ModuleMember -Function Show-GHUnsized -Export-ModuleMember -Function Show-GHToDiscuss \ No newline at end of file +Export-ModuleMember -Function Show-GHToDiscuss +Export-ModuleMember -Function Get-GHNoMilestone +Export-ModuleMember -Function Show-GHNoMilestone \ No newline at end of file