Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion public/addRepoIssueComment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function Get-RepoIssue{
return $null
}

$param = @{ owner = $Owner ; repo = $Repo; attributes="number,title,url" }
$param = @{ owner = $Owner ; repo = $Repo; attributes="number,title,state,url" }

# Return the URL of the comment
$result = Invoke-MyCommandJson -Command ListRepoIssues -Parameters $param
Expand Down
8 changes: 7 additions & 1 deletion public/getRepoAccess.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ function Get-RepoAccess{
[OutputType([hashtable])]
param(
[Parameter()] [string]$Owner,
[Parameter()] [string]$Repo
[Parameter()] [string]$Repo,
[Parameter()] [string]$Role
)

# Resolve repo name from parameters or environment
Expand All @@ -33,6 +34,11 @@ function Get-RepoAccess{
# no need to unique the list as github makes them exclusive
$ret = $access + $invitations

if($Role){
"Filtering by role: $Role" | Write-Verbose
$ret = $ret.GetEnumerator() | Where-Object { $_.Value -like "$Role*" }
}

"Found $($ret.Count) users with access or invitations" | Write-Verbose

return $ret
Expand Down
37 changes: 26 additions & 11 deletions public/getRepoAccessTeam.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,9 @@
}

# Get access Control
$accessList = Get-RepoAccess -Owner $owner -Repo $repo

if($Role){
"Filtering by role: $Role" | Write-Verbose
$accessList = $accessList.GetEnumerator() | Where-Object { $_.Value -like "$Role*" }
}
$accessList = Get-RepoAccess -Owner $owner -Repo $repo -Role:$Role


# Sort by access
$accessList = $accessList.GetEnumerator() | Sort-Object -Property Value

Expand Down Expand Up @@ -109,13 +105,13 @@
)

process{

$parameters = @{
login = $Login
}

$result = Invoke-MyCommandJson -Command GetUser -Parameters $parameters
$result = Get-UserInfo -Login $Login

if($null -eq $result){
"Error: $Login not found" | Write-Error
return
}
$ret = [PSCustomObject]@{
login = $result.login
name = $result.name
Expand All @@ -131,3 +127,22 @@
}
} Export-ModuleMember -Function Get-RepoUser

function Get-UserInfo{

Check notice

Code scanning / PSScriptAnalyzer

The cmdlet 'Get-UserInfo' does not have a help comment. Note

The cmdlet 'Get-UserInfo' does not have a help comment.
[CmdletBinding()]
[OutputType([PSCustomObject])]
param(
[Parameter(Position=0,ValueFromPipeline)][string]$Login
)

process{
$user = Invoke-MyCommandJson -Command GetUser -Parameters @{login = $Login}

if($user.login -ne $Login){
"Error: $login not found" | Write-Error
return $null
}

return $user
}
} Export-ModuleMember -Function Get-UserInfo

11 changes: 11 additions & 0 deletions public/hashtable.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function Convert-HashtableToObject {

Check notice

Code scanning / PSScriptAnalyzer

The cmdlet 'Convert-HashtableToObject' does not have a help comment. Note

The cmdlet 'Convert-HashtableToObject' does not have a help comment.
param (
[hashtable]$Hashtable
)
$Hashtable.GetEnumerator() | ForEach-Object {
[PSCustomObject]@{
Handle=$_.Key
Role=$_.Value
}
}
} Export-ModuleMember -Function Convert-HashtableToObject
Loading