]> us-delaporte.pagekite.me Git - dotfiles.git/blob - psmodules/edgithub.psm1
Show-GHToDiscuss drafted
[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 .SYNPOSIS
26
27 Fetch GitHub issues that are tagged to discuss this morning.
28
29 #>
30 function Get-GHToDiscuss {
31 param(
32 [int]$days = -14
33 )
34 $repos = @('SecOps-Tools', 'secdev-job-aids', 'awscli-login')
35 $issueSearchParams = @{ State = 'open'; OwnerName = 'techservicesillinois' }
36 $closed = @()
37 $repos | ForEach-Object {
38 $closed += Get-GitHubIssue -RepositoryName $_ @issueSearchParams
39 }
40 $issues = $issues | Where-Object { $_.labels -Contains 'DiscussAtStandUp' }
41
42 return $issues
43 }
44
45
46 <#
47 .SYNOPSIS
48
49 Show closed GitHub issues that were updated in the last 14 days.
50
51 #>
52 function Show-GHClosed() {
53 param(
54 [int]$days = -14
55 )
56 Get-GHClosed -days $days | ForEach-Object {
57 # Markdown output
58 " + [" + $_.Title + " (" + $_.Number + ")](" + $_.html_url + ")"
59 }
60 # Format-Table -Property Number, Title, Url
61
62 }
63
64 <#
65 .SYNPOSIS
66
67 Fetch GitHub issues I am working on.
68
69 #>
70 function Get-GHMine() {
71 $repos = @('SecOps-Tools', 'secdev-job-aids', 'awscli-login')
72 $issueSearchParams = @{ Assignee = 'edthedev'; State = 'open'; OwnerName = 'techservicesillinois' }
73 $issues = @()
74 $repos | ForEach-Object {
75 $issues += Get-GitHubIssue -RepositoryName $_ @issueSearchParams
76 }
77
78 # Ignore issues that have been updated in the last day.
79 $issues = $issues | Where-Object { $_.updated_at -lt (Get-Date).AddDays(-1) }
80
81 return $issues
82 }
83
84 <#
85 .SYNOPSIS
86
87 Show GitHub issues I am working on.
88
89 #>
90 function Show-GHMine() {
91 Get-GHMine | ForEach-Object {
92 # Markdown output
93 " + [" + $_.Title + " (" + $_.Number + ")](" + $_.html_url + ")"
94 }
95 }
96
97 <#
98
99 Target GitHub search:
100 is:open is:issue -label:M -label:L -label:S -label:XL -label:XS
101
102 #>
103 function Get-GHUnsized() {
104 $repos = @('SecOps-Tools', 'secdev-job-aids', 'awscli-login')
105 $issueSearchParams = @{ State = 'open'; OwnerName = 'techservicesillinois' }
106 $issues = @()
107 $repos | ForEach-Object {
108 $issues += Get-GitHubIssue -RepositoryName $_ @issueSearchParams
109 }
110
111 # Ignore issues that have been updated in the last day.
112 $issues = $issues | Where-Object { -Not $_.labels -Contains 'XS' }
113 $issues = $issues | Where-Object { -Not $_.labels -Contains 'S' }
114 $issues = $issues | Where-Object { -Not $_.labels -Contains 'M' }
115 $issues = $issues | Where-Object { -Not $_.labels -Contains 'L' }
116 # Leave XL issues, as they need split.
117
118 return $issues
119 }
120
121 function Show-GHUnsized() {
122 Get-GHUnsized | ForEach-Object {
123 # Markdown output
124 " + [" + $_.Title + " (" + $_.Number + ")](" + $_.html_url + ")" + $_.labels
125 }
126 }
127
128 function Show-GHToDiscuss() {
129 Get-GHToDiscuss | Show-GHIssuesAsMarkdown
130 }
131
132
133 function Show-GHIssuesAsMarkdown() {
134 process
135 {
136 # Markdown output
137 " + [" + $_.Title + " (" + $_.Number + ")](" + $_.html_url + ")" + $_.labels
138 }
139 }
140
141
142 Export-ModuleMember -Function Get-GHClosed
143 Export-ModuleMember -Function Show-GHClosed
144 Export-ModuleMember -Function Get-GHMine
145 Export-ModuleMember -Function Show-GHMine
146 Export-ModuleMember -Function Get-GHUnsized
147 Export-ModuleMember -Function Show-GHUnsized
148 Export-ModuleMember -Function Show-GHToDiscuss