]> apps.delaporte.us Git - dotfiles.git/blobdiff - psmodules/edgithub.psm1
Utility to show unsized GitHub issues.
[dotfiles.git] / psmodules / edgithub.psm1
index 0f26e2433919ada46c4dcc1006d16162d3809fbc..76b7feb5e628b98de98274ab44bbf14d8a5d0744 100644 (file)
@@ -39,5 +39,73 @@ function Show-GHClosed() {
 
 }
 
+<#
+.SYNPOSIS
+
+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' }
+  $issues = @()
+  $repos | ForEach-Object { 
+    $issues += Get-GitHubIssue -RepositoryName $_ @issueSearchParams
+  }
+
+  # Ignore issues that have been updated in the last day.
+  $issues = $issues | Where-Object { $_.updated_at -lt (Get-Date).AddDays(-1) }
+
+  return $issues
+}
+
+<#
+.SYNOPSIS
+
+Show GitHub issues I am working on.
+
+#>
+function Show-GHMine() {
+  Get-GHMine | ForEach-Object {
+    # Markdown output
+    " + [" + $_.Title + " (" + $_.Number + ")](" + $_.html_url + ")"
+  }
+}
+
+<#
+
+Target 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')
+  $issueSearchParams = @{ State = 'open'; OwnerName = 'techservicesillinois' }
+  $issues = @()
+  $repos | ForEach-Object { 
+    $issues += Get-GitHubIssue -RepositoryName $_ @issueSearchParams
+  }
+
+  # Ignore issues that have been updated in the last day.
+  $issues = $issues | Where-Object { -Not $_.labels -Contains 'XS' }
+  $issues = $issues | Where-Object { -Not $_.labels -Contains 'S' }
+  $issues = $issues | Where-Object { -Not $_.labels -Contains 'M' }
+  $issues = $issues | Where-Object { -Not $_.labels -Contains 'L' }
+  # Leave XL issues, as they need split.
+
+  return $issues
+}
+
+function Show-GHUnsized() {
+  Get-GHUnsized | ForEach-Object {
+    # Markdown output
+    " + [" + $_.Title + " (" + $_.Number + ")](" + $_.html_url + ")" + $_.labels
+  }
+}
+
 Export-ModuleMember -Function Get-GHClosed
-Export-ModuleMember -Function Show-GHClosed
\ No newline at end of file
+Export-ModuleMember -Function Show-GHClosed
+Export-ModuleMember -Function Get-GHMine
+Export-ModuleMember -Function Show-GHMine
+Export-ModuleMember -Function Get-GHUnsized
+Export-ModuleMember -Function Show-GHUnsized
\ No newline at end of file