From: Edward Delaporte Date: Thu, 11 Nov 2021 19:35:37 +0000 (-0600) Subject: Repository flag for NoMilestone X-Git-Url: https://apps.delaporte.us/gitweb/dotfiles.git/commitdiff_plain/d182fb2cf69c77df54912299bd3bf1e3f48d10c8 Repository flag for NoMilestone --- diff --git a/Microsoft.PowerShell_profile.ps1 b/Microsoft.PowerShell_profile.ps1 index a57c48a..bc14d5d 100644 --- a/Microsoft.PowerShell_profile.ps1 +++ b/Microsoft.PowerShell_profile.ps1 @@ -100,6 +100,11 @@ function Get-GitStatus() { git status -b --short } +# Tell my scripts which GitHub repositories to look in. +$env:GITHUB_USERNAME = 'edthedev' +$env:GITHUB_ORG = 'techservicesillinois' +$env:GITHUB_REPOS = @('SecOps-Tools', 'secdev-job-aids', 'awscli-login') + # Nice for git New-Alias ol Get-GitLog New-Alias st Get-GitStatus diff --git a/psmodules/dash.psm1 b/psmodules/dash.psm1 index 3bfb4c6..99c5a3c 100644 --- a/psmodules/dash.psm1 +++ b/psmodules/dash.psm1 @@ -9,7 +9,7 @@ function Get-MyDashBoard() { Write-Host "## GitHub Issues Assigned" Show-GHMine Write-Host "## GitHub Issues with no milestone. (Show-GHNoMilestone)" - Get-GHNoMilestone | Measure-Object -Property updated_at -Min -Max + Get-GHNoMilestone -repository SecOps-Tools | Measure-Object -Property updated_at -Min -Max Write-Host "Use command 'todo' to list more tasks." Write-Host "Use command 'chart' to show todo item progress." Write-Host "Use command 'agenda' to list the plan for today." diff --git a/psmodules/edgithub.psm1 b/psmodules/edgithub.psm1 index 8822bd3..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 @@ -106,7 +114,7 @@ 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 { @@ -124,7 +132,13 @@ function Get-GHUnsized() { } function Get-GHNoMilestone() { - $repos = @('SecOps-Tools', 'secdev-job-aids', 'awscli-login') + param( + [string]$repository + ) + $repos = $env:GITHUB_REPOS.split(" ") + if($repository){ + $repos = @($repository) + } $issueSearchParams = @{ State = 'open'; OwnerName = 'techservicesillinois' } $issues = @() $repos | ForEach-Object { @@ -136,7 +150,10 @@ function Get-GHNoMilestone() { return $issues } function Show-GHNoMilestone(){ - Get-GHNoMilestone| Show-GHIssuesAsMarkdown + param( + [string]$repository + ) + Get-GHNoMilestone -Repository $repository | Show-GHIssuesAsMarkdown } function Show-GHUnsized() { @@ -147,7 +164,7 @@ function Show-GHUnsized() { } function Show-GHByAssignee() { - $repos = @('SecOps-Tools', 'secdev-job-aids', 'awscli-login') + $repos = $env:GITHUB_REPOS.split(" ") $issueSearchParams = @{ State = 'open'; OwnerName = 'techservicesillinois' } $issues = @() $repos | ForEach-Object {