]> us-delaporte.pagekite.me Git - dotfiles.git/blob - psmodules/edgithub.psm1
76b7feb5e628b98de98274ab44bbf14d8a5d0744
[dotfiles.git] / psmodules / edgithub.psm1
1 <#
2 .SYNPOSIS
3
4 Fetch closed GitHub issues that were updated in the last 14 days.
5
6 #>
7 function Get-GHClosed {
8 param(
9 [int]$days = -14
10 )
11 $repos = @('SecOps-Tools', 'secdev-job-aids', 'awscli-login')
12 $issueSearchParams = @{ State = 'closed'; OwnerName = 'techservicesillinois' }
13 $closed = @()
14 $repos | ForEach-Object {
15 $closed += Get-GitHubIssue -RepositoryName $_ @issueSearchParams
16 }
17
18 # Limit to past two weeks
19 $issues = $closed | Where-Object { $_.updated_at -gt (Get-Date).AddDays($days) }
20 return $issues
21 }
22
23
24 <#
25 .SYNOPSIS
26
27 Show closed GitHub issues that were updated in the last 14 days.
28
29 #>
30 function Show-GHClosed() {
31 param(
32 [int]$days = -14
33 )
34 Get-GHClosed -days $days | ForEach-Object {
35 # Markdown output
36 " + [" + $_.Title + " (" + $_.Number + ")](" + $_.html_url + ")"
37 }
38 # Format-Table -Property Number, Title, Url
39
40 }
41
42 <#
43 .SYNPOSIS
44
45 Fetch GitHub issues I am working on.
46
47 #>
48 function Get-GHMine() {
49 $repos = @('SecOps-Tools', 'secdev-job-aids', 'awscli-login')
50 $issueSearchParams = @{ Assignee = 'edthedev'; State = 'open'; OwnerName = 'techservicesillinois' }
51 $issues = @()
52 $repos | ForEach-Object {
53 $issues += Get-GitHubIssue -RepositoryName $_ @issueSearchParams
54 }
55
56 # Ignore issues that have been updated in the last day.
57 $issues = $issues | Where-Object { $_.updated_at -lt (Get-Date).AddDays(-1) }
58
59 return $issues
60 }
61
62 <#
63 .SYNOPSIS
64
65 Show GitHub issues I am working on.
66
67 #>
68 function Show-GHMine() {
69 Get-GHMine | ForEach-Object {
70 # Markdown output
71 " + [" + $_.Title + " (" + $_.Number + ")](" + $_.html_url + ")"
72 }
73 }
74
75 <#
76
77 Target GitHub search:
78 is:open is:issue -label:M -label:L -label:S -label:XL -label:XS
79
80 #>
81 function Get-GHUnsized() {
82 $repos = @('SecOps-Tools', 'secdev-job-aids', 'awscli-login')
83 $issueSearchParams = @{ State = 'open'; OwnerName = 'techservicesillinois' }
84 $issues = @()
85 $repos | ForEach-Object {
86 $issues += Get-GitHubIssue -RepositoryName $_ @issueSearchParams
87 }
88
89 # Ignore issues that have been updated in the last day.
90 $issues = $issues | Where-Object { -Not $_.labels -Contains 'XS' }
91 $issues = $issues | Where-Object { -Not $_.labels -Contains 'S' }
92 $issues = $issues | Where-Object { -Not $_.labels -Contains 'M' }
93 $issues = $issues | Where-Object { -Not $_.labels -Contains 'L' }
94 # Leave XL issues, as they need split.
95
96 return $issues
97 }
98
99 function Show-GHUnsized() {
100 Get-GHUnsized | ForEach-Object {
101 # Markdown output
102 " + [" + $_.Title + " (" + $_.Number + ")](" + $_.html_url + ")" + $_.labels
103 }
104 }
105
106 Export-ModuleMember -Function Get-GHClosed
107 Export-ModuleMember -Function Show-GHClosed
108 Export-ModuleMember -Function Get-GHMine
109 Export-ModuleMember -Function Show-GHMine
110 Export-ModuleMember -Function Get-GHUnsized
111 Export-ModuleMember -Function Show-GHUnsized