From bc5dcc6de0c7b59dbb5cce3dd8e125312857249a Mon Sep 17 00:00:00 2001 From: Simon Heather Date: Sat, 7 Nov 2020 17:38:29 +0000 Subject: [PATCH 1/5] Initial commit --- Formatters/GitHubRepositories.Format.ps1xml | 27 +++ GitHubRepositories.ps1 | 242 ++++++++++++++++++++ PowerShellForGitHub.psd1 | 2 + README.md | 1 + Tests/GitHubRepositories.tests.ps1 | 93 ++++++++ USAGE.md | 14 ++ 6 files changed, 379 insertions(+) diff --git a/Formatters/GitHubRepositories.Format.ps1xml b/Formatters/GitHubRepositories.Format.ps1xml index 5325fd19..be80b3c4 100644 --- a/Formatters/GitHubRepositories.Format.ps1xml +++ b/Formatters/GitHubRepositories.Format.ps1xml @@ -177,5 +177,32 @@ + + + GitHub.RepositoryActionsPermission + + GitHub.RepositoryActionsPermission + + + + + + + RepositoryName + + + RepositoryUri + + + Enabled + + + AllowedActions + + + + + + diff --git a/GitHubRepositories.ps1 b/GitHubRepositories.ps1 index 9e56a2f5..695e2c8b 100644 --- a/GitHubRepositories.ps1 +++ b/GitHubRepositories.ps1 @@ -9,6 +9,7 @@ GitHubRepositoryContributorStatisticsTypeName = 'GitHub.RepositoryContributorStatistics' GitHubRepositoryLanguageTypeName = 'GitHub.RepositoryLanguage' GitHubRepositoryTagTypeName = 'GitHub.RepositoryTag' + GitHubRepositoryActionsPermissionTypeName = 'GitHub.RepositoryActionsPermission' }.GetEnumerator() | ForEach-Object { Set-Variable -Scope Script -Option ReadOnly -Name $_.Key -Value $_.Value } @@ -2692,6 +2693,247 @@ filter Disable-GitHubRepositorySecurityFix Invoke-GHRestMethod @params | Out-Null } +filter Get-GitHubRepositoryActionsPermission +{ + <# + .SYNOPSIS + Gets GitHub Actions permission for a repository on GitHub. + + .DESCRIPTION + Gets GitHub Actions permission for a repository on GitHub. + + The Git repo for this module can be found here: http://aka.ms/PowerShellForGitHub + + .PARAMETER OwnerName + Owner of the repository. + If not supplied here, the DefaultOwnerName configuration property value will be used. + + .PARAMETER RepositoryName + Name of the repository. + If not supplied here, the DefaultRepositoryName configuration property value will be used. + + .PARAMETER Uri + Uri for the repository. + The OwnerName and RepositoryName will be extracted from here instead of needing to provide + them individually. + + .PARAMETER AccessToken + If provided, this will be used as the AccessToken for authentication with the + REST Api. Otherwise, will attempt to use the configured value or will run unauthenticated. + + .INPUTS + GitHub.Branch + GitHub.Content + GitHub.Event + GitHub.Issue + GitHub.IssueComment + GitHub.Label + GitHub.Milestone + GitHub.PullRequest + GitHub.Project + GitHub.ProjectCard + GitHub.ProjectColumn + GitHub.Release + GitHub.Repository + + .OUTPUTS + GitHub.RepositoryActionsPermission + + .NOTES + The authenticated user must have admin access to the repository. + + .EXAMPLE + Get-GitHubRepositoryActionsPermission -OwnerName Microsoft -RepositoryName PowerShellForGitHub + + Gets GitHub Actions permissions for the PowerShellForGithub repository. + + .EXAMPLE + Get-GitHubRepositoryActionsPermission -Uri https://github.com/PowerShell/PowerShellForGitHub + + Gets GitHub Actions permissions for the PowerShellForGithub repository. +#> + [CmdletBinding( + PositionalBinding = $false, + DefaultParameterSetName='Elements')] + param( + [Parameter( + ParameterSetName='Elements')] + [string] $OwnerName, + + [Parameter(ParameterSetName='Elements')] + [string] $RepositoryName, + + [Parameter( + Mandatory, + Position = 1, + ValueFromPipelineByPropertyName, + ParameterSetName='Uri')] + [Alias('RepositoryUrl')] + [string] $Uri, + + [string] $AccessToken + ) + + Write-InvocationLog + + $elements = Resolve-RepositoryElements -BoundParameters $PSBoundParameters + $OwnerName = $elements.ownerName + $RepositoryName = $elements.repositoryName + + $telemetryProperties = @{ + 'OwnerName' = (Get-PiiSafeString -PlainText $OwnerName) + 'RepositoryName' = (Get-PiiSafeString -PlainText $RepositoryName) + } + + $params = @{ + UriFragment = "/repos/$OwnerName/$RepositoryName/actions/permissions" + Description = "Getting GitHub Actions permissions for $RepositoryName" + Method = 'Get' + AccessToken = $AccessToken + TelemetryEventName = $MyInvocation.MyCommand.Name + TelemetryProperties = $telemetryProperties + } + + $result = Invoke-GHRestMethod @params + + return [PSCustomObject]@{ + PSTypeName = $GitHubRepositoryActionsPermissionTypeName + RepositoryName = $RepositoryName + RepositoryUri = "https://github.com/$OwnerName/$RepositoryName" + Enabled = $result.enabled + AllowedActions = $result.allowed_actions + } +} + +filter Set-GitHubRepositoryActionsPermission +{ + <# + .SYNOPSIS + Sets GitHub Actions permissions for a repository on GitHub. + + .DESCRIPTION + Sets GitHub Actions permissions for a repository on GitHub. + + The Git repo for this module can be found here: http://aka.ms/PowerShellForGitHub + + .PARAMETER OwnerName + Owner of the repository. + If not supplied here, the DefaultOwnerName configuration property value will be used. + + .PARAMETER RepositoryName + Name of the repository. + If not supplied here, the DefaultRepositoryName configuration property value will be used. + + .PARAMETER Uri + Uri for the repository. + The OwnerName and RepositoryName will be extracted from here instead of needing to provide + them individually. + + .PARAMETER AccessToken + If provided, this will be used as the AccessToken for authentication with the + REST Api. Otherwise, will attempt to use the configured value or will run unauthenticated. + + .INPUTS + GitHub.Branch + GitHub.Content + GitHub.Event + GitHub.Issue + GitHub.IssueComment + GitHub.Label + GitHub.Milestone + GitHub.PullRequest + GitHub.Project + GitHub.ProjectCard + GitHub.ProjectColumn + GitHub.Release + GitHub.Repository + + .OUTPUTS + None + + .NOTES + The authenticated user must have admin access to the repository. + + .EXAMPLE + Set-GitHubRepositoryActionsPermission -OwnerName Microsoft -RepositoryName PowerShellForGitHub -AllowedActions All + + Sets GitHub Actions permissions to 'All' for the PowerShellForGithub repository. + + .EXAMPLE + Set-GitHubRepositoryActionsPermission -Uri https://github.com/PowerShell/PowerShellForGitHub -AllowedActions Disabled + + Sets GitHub Actions permissions to 'Disabled' for the PowerShellForGithub repository. +#> + [CmdletBinding( + PositionalBinding = $false, + SupportsShouldProcess, + DefaultParameterSetName='Elements')] + param( + [Parameter( + ParameterSetName='Elements')] + [string] $OwnerName, + + [Parameter(ParameterSetName='Elements')] + [string] $RepositoryName, + + [Parameter( + Mandatory, + Position = 1, + ValueFromPipelineByPropertyName, + ParameterSetName='Uri')] + [Alias('RepositoryUrl')] + [string] $Uri, + + [Parameter(Mandatory)] + [ValidateSet('All', 'Local_Only', 'Selected', 'Disabled')] + [string] $AllowedActions, + + [string] $AccessToken + ) + + Write-InvocationLog + + $elements = Resolve-RepositoryElements -BoundParameters $PSBoundParameters + $OwnerName = $elements.ownerName + $RepositoryName = $elements.repositoryName + + $telemetryProperties = @{ + 'OwnerName' = (Get-PiiSafeString -PlainText $OwnerName) + 'RepositoryName' = (Get-PiiSafeString -PlainText $RepositoryName) + } + + if ($AllowedActions -eq 'Disabled') + { + $hashBody = @{ + 'enabled' = $false + } + } + else + { + $hashBody = @{ + 'enabled' = $true + 'allowed_actions' = $AllowedActions.ToLower() + } + } + + if (-not $PSCmdlet.ShouldProcess($RepositoryName, 'Set GitHub Repository Actions Permissions')) + { + return + } + + $params = @{ + UriFragment = "/repos/$OwnerName/$RepositoryName/actions/permissions" + Description = "Setting GitHub Actions permissions for $RepositoryName" + Method = 'Put' + Body = (ConvertTo-Json -InputObject $hashBody) + AccessToken = $AccessToken + TelemetryEventName = $MyInvocation.MyCommand.Name + TelemetryProperties = $telemetryProperties + } + + Invoke-GHRestMethod @params | Out-Null +} + filter Add-GitHubRepositoryAdditionalProperties { <# diff --git a/PowerShellForGitHub.psd1 b/PowerShellForGitHub.psd1 index 680a9dea..f72f0ab4 100644 --- a/PowerShellForGitHub.psd1 +++ b/PowerShellForGitHub.psd1 @@ -101,6 +101,7 @@ 'Get-GitHubRelease', 'Get-GitHubReleaseAsset', 'Get-GitHubRepository', + 'Get-GitHubRepositoryActionsPermission', 'Get-GitHubRepositoryBranch', 'Get-GitHubRepositoryBranchProtectionRule', 'Get-GitHubRepositoryCollaborator', @@ -188,6 +189,7 @@ 'Set-GitHubRelease', 'Set-GitHubReleaseAsset', 'Set-GitHubRepository', + 'Set-GitHubRepositoryActionsPermission', 'Set-GitHubRepositoryTopic', 'Set-GitHubTeam', 'Split-GitHubUri', diff --git a/README.md b/README.md index 88b36463..765a426c 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ At present, this module can: * Query the languages and tags in a repository, and and query/update its topics. * Change repository ownership. * Query, enable and disable security and vulnerability alerts. + * Query and set GitHub Actions permission. * Query various [traffic reports](https://developer.github.com/v3/repos/traffic/) including referral sources and paths, page views and clones. * Query, create, edit, lock/unlock [Issues](https://developer.github.com/v3/issues/) and diff --git a/Tests/GitHubRepositories.tests.ps1 b/Tests/GitHubRepositories.tests.ps1 index 40743ec7..dcad0ccc 100644 --- a/Tests/GitHubRepositories.tests.ps1 +++ b/Tests/GitHubRepositories.tests.ps1 @@ -1379,6 +1379,99 @@ try Remove-GitHubRepository -Uri $repo.svn_url -Force } } + + Describe 'GitHubRepositories\Get-GitHubRepositoryActionsPermission' { + BeforeAll { + $repoName = [Guid]::NewGuid().Guid + $repo = New-GitHubRepository -RepositoryName $repoName + + $allowedActions = 'All', 'Local_Only', 'Selected', 'Disabled' + } + + foreach ($allowedAction in $allowedActions) + { + Context "When the AllowedAction is $allowedAction" { + BeforeAll { + $setGitHubRepositoryActionsPermissionParms = @{ + Uri = $repo.svn_url + AllowedActions = $allowedAction + } + + Set-GitHubRepositoryActionsPermission @setGitHubRepositoryActionsPermissionParms + + $permissions = Get-GitHubRepositoryActionsPermission -Uri $repo.svn_url + } + + It 'Should return the correct type and properties' { + $permissions.PSObject.TypeNames[0] | Should -Be 'GitHub.RepositoryActionsPermission' + + $permissions.RepositoryName | Should -Be $repoName + $permissions.RepositoryUri | Should -Be $repo.svn_url + + if ($allowedAction -eq 'Disabled') + { + $permissions.Enabled | Should -BeFalse + } + else + { + $permissions.Enabled | Should -BeTrue + $permissions.AllowedActions | Should -Be $allowedAction + } + } + } + } + + AfterAll { + if (Get-Variable -Name repo -ErrorAction SilentlyContinue) + { + $repo | Remove-GitHubRepository -Force + } + } + } + + Describe 'GitHubRepositories\Set-GitHubRepositoryActionsPermission' { + BeforeAll { + $repo = New-GitHubRepository -RepositoryName ([Guid]::NewGuid().Guid) + + $allowedActions = 'All', 'Local_Only', 'Selected', 'Disabled' + } + + foreach ($allowedAction in $allowedActions) + { + Context "When the AllowedAction Parameter is $allowedAction" { + BeforeAll { + $setGitHubRepositoryActionsPermissionParms = @{ + Uri = $repo.svn_url + AllowedActions = $allowedAction + } + + Set-GitHubRepositoryActionsPermission @setGitHubRepositoryActionsPermissionParms + } + + It 'Should have set the expected permissions' { + $permissions = Get-GitHubRepositoryActionsPermission -Uri $repo.svn_url + + if ($allowedAction -eq 'Disabled') + { + $permissions.Enabled | Should -BeFalse + } + else + { + $permissions.Enabled | Should -BeTrue + $permissions.AllowedActions | Should -Be $allowedAction + } + } + } + } + + AfterAll { + if (Get-Variable -Name repo -ErrorAction SilentlyContinue) + { + $repo | Remove-GitHubRepository -Force + } + } + } + } finally { diff --git a/USAGE.md b/USAGE.md index 60b2aef5..58843423 100644 --- a/USAGE.md +++ b/USAGE.md @@ -53,6 +53,8 @@ * [Disable repository vulnerability alerts](#disable-repository-vulnerability-alerts) * [Enable repository automatic security fixes](#enable-repository-automatic-security-fixes) * [Disable repository automatic security fixes](#disable-repository-automatic-security-fixes) + * [Get repository GitHub Actions permissions](#get-repository-github-actions-permissions) + * [Set repository GitHub Actions permissions](#set-repository-github-actions-permissions) * [Branches](#branches) * [Adding a new Branch to a Repository](#adding-a-new-branch-to-a-repository) * [Removing a Branch from a Repository](#removing-a-branch-from-a-repository) @@ -646,6 +648,18 @@ Enable-GitHubRepositorySecurityFix -OwnerName microsoft -RepositoryName PowerShe Disable-GitHubRepositorySecurityFix -OwnerName microsoft -RepositoryName PowerShellForGitHub ``` +#### Get repository GitHub Actions permissions + +```powershell +Get-GitHubRepositoryActionsPermission -OwnerName microsoft -RepositoryName PowerShellForGitHub +``` + +#### Set repository GitHub Actions permissions + +```powershell +Set-GitHubRepositoryActionsPermission -OwnerName microsoft -RepositoryName PowerShellForGitHub -AllowedActions All +``` + ---------- ### Branches From 028c14f09cb66f9423c10d936bfd4a7ecbb39337 Mon Sep 17 00:00:00 2001 From: Simon Heather Date: Sun, 8 Nov 2020 11:58:27 +0000 Subject: [PATCH 2/5] Add AllowedActions comment based help --- GitHubRepositories.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/GitHubRepositories.ps1 b/GitHubRepositories.ps1 index 695e2c8b..1db48674 100644 --- a/GitHubRepositories.ps1 +++ b/GitHubRepositories.ps1 @@ -2829,6 +2829,10 @@ filter Set-GitHubRepositoryActionsPermission The OwnerName and RepositoryName will be extracted from here instead of needing to provide them individually. + .PARAMETER AllowedActions + The permissions policy that controls the actions that are allowed to run. + Can be one of: 'All', 'Local_Only', 'Selected' or 'Disabled'. + .PARAMETER AccessToken If provided, this will be used as the AccessToken for authentication with the REST Api. Otherwise, will attempt to use the configured value or will run unauthenticated. From f7b254acb0898477cf4186998eea8e88942683c0 Mon Sep 17 00:00:00 2001 From: Simon Heather Date: Sun, 22 Nov 2020 10:37:31 +0000 Subject: [PATCH 3/5] Add pipeline tests --- Tests/GitHubRepositories.tests.ps1 | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Tests/GitHubRepositories.tests.ps1 b/Tests/GitHubRepositories.tests.ps1 index dcad0ccc..d44b1da7 100644 --- a/Tests/GitHubRepositories.tests.ps1 +++ b/Tests/GitHubRepositories.tests.ps1 @@ -1421,6 +1421,16 @@ try } } + Context "When specifiying the 'URI' Parameter from the Pipeline" { + BeforeAll { + $permissions = $repo | Get-GitHubRepositoryActionsPermission + } + + It 'Should return an object of the correct type' { + $permissions.PSObject.TypeNames[0] | Should -Be 'GitHub.RepositoryActionsPermission' + } + } + AfterAll { if (Get-Variable -Name repo -ErrorAction SilentlyContinue) { @@ -1464,6 +1474,13 @@ try } } + Context "When specifiying the 'URI' Parameter from the Pipeline" { + It 'Should not throw' { + { $repo | Set-GitHubRepositoryActionsPermission -AllowedActions 'All' } | + Should -Not -Throw + } + } + AfterAll { if (Get-Variable -Name repo -ErrorAction SilentlyContinue) { @@ -1471,7 +1488,6 @@ try } } } - } finally { From b0ff0c224421c7e32b5057bac52b21d3c494f26d Mon Sep 17 00:00:00 2001 From: Simon Heather Date: Sat, 5 Dec 2020 11:04:07 +0000 Subject: [PATCH 4/5] review updates --- Formatters/GitHubRepositories.Format.ps1xml | 2 +- GitHubRepositories.ps1 | 108 +++++++++++++++++--- Tests/GitHubRepositories.tests.ps1 | 6 +- 3 files changed, 99 insertions(+), 17 deletions(-) diff --git a/Formatters/GitHubRepositories.Format.ps1xml b/Formatters/GitHubRepositories.Format.ps1xml index be80b3c4..d128df0f 100644 --- a/Formatters/GitHubRepositories.Format.ps1xml +++ b/Formatters/GitHubRepositories.Format.ps1xml @@ -191,7 +191,7 @@ RepositoryName - RepositoryUri + RepositoryUrl Enabled diff --git a/GitHubRepositories.ps1 b/GitHubRepositories.ps1 index 1db48674..18a07205 100644 --- a/GitHubRepositories.ps1 +++ b/GitHubRepositories.ps1 @@ -2,6 +2,7 @@ # Licensed under the MIT License. @{ + GitHubRepositoryActionsPermissionTypeName = 'GitHub.RepositoryActionsPermission' GitHubRepositoryTypeName = 'GitHub.Repository' GitHubRepositoryTopicTypeName = 'GitHub.RepositoryTopic' GitHubRepositoryContributorTypeName = 'GitHub.RepositoryContributor' @@ -9,7 +10,6 @@ GitHubRepositoryContributorStatisticsTypeName = 'GitHub.RepositoryContributorStatistics' GitHubRepositoryLanguageTypeName = 'GitHub.RepositoryLanguage' GitHubRepositoryTagTypeName = 'GitHub.RepositoryTag' - GitHubRepositoryActionsPermissionTypeName = 'GitHub.RepositoryActionsPermission' }.GetEnumerator() | ForEach-Object { Set-Variable -Scope Script -Option ReadOnly -Name $_.Key -Value $_.Value } @@ -2794,15 +2794,8 @@ filter Get-GitHubRepositoryActionsPermission TelemetryProperties = $telemetryProperties } - $result = Invoke-GHRestMethod @params - - return [PSCustomObject]@{ - PSTypeName = $GitHubRepositoryActionsPermissionTypeName - RepositoryName = $RepositoryName - RepositoryUri = "https://github.com/$OwnerName/$RepositoryName" - Enabled = $result.enabled - AllowedActions = $result.allowed_actions - } + return (Invoke-GHRestMethod @params | + Add-GitHubRepositoryActionsPermissionAdditionalProperties -RepositoryName $RepositoryName -OwnerName $OwnerName) } filter Set-GitHubRepositoryActionsPermission @@ -2831,7 +2824,7 @@ filter Set-GitHubRepositoryActionsPermission .PARAMETER AllowedActions The permissions policy that controls the actions that are allowed to run. - Can be one of: 'All', 'Local_Only', 'Selected' or 'Disabled'. + Can be one of: 'All', 'LocalOnly', 'Selected' or 'Disabled'. .PARAMETER AccessToken If provided, this will be used as the AccessToken for authentication with the @@ -2858,6 +2851,10 @@ filter Set-GitHubRepositoryActionsPermission .NOTES The authenticated user must have admin access to the repository. + If the repository belongs to an organization or enterprise that has set restrictive + permissions at the organization or enterprise levels, such as 'AllowedActions' to 'Selected' + actions, then you cannot override them for the repository. + .EXAMPLE Set-GitHubRepositoryActionsPermission -OwnerName Microsoft -RepositoryName PowerShellForGitHub -AllowedActions All @@ -2889,7 +2886,7 @@ filter Set-GitHubRepositoryActionsPermission [string] $Uri, [Parameter(Mandatory)] - [ValidateSet('All', 'Local_Only', 'Selected', 'Disabled')] + [ValidateSet('All', 'LocalOnly', 'Selected', 'Disabled')] [string] $AllowedActions, [string] $AccessToken @@ -2906,6 +2903,15 @@ filter Set-GitHubRepositoryActionsPermission 'RepositoryName' = (Get-PiiSafeString -PlainText $RepositoryName) } + $allowedActionsConverter = @{ + All = 'all' + LocalOnly = 'local_only' + Selected = 'selected' + Disabled = 'disabled' + } + + $hashBodyAllowedActions = $allowedActionsConverter[$AllowedActions] + if ($AllowedActions -eq 'Disabled') { $hashBody = @{ @@ -2916,7 +2922,7 @@ filter Set-GitHubRepositoryActionsPermission { $hashBody = @{ 'enabled' = $true - 'allowed_actions' = $AllowedActions.ToLower() + 'allowed_actions' = $hashBodyAllowedActions } } @@ -3213,3 +3219,79 @@ filter Add-GitHubRepositoryCollaboratorAdditionalProperties Write-Output $item } } + +filter Add-GitHubRepositoryActionsPermissionAdditionalProperties +{ + <# + .SYNOPSIS + Adds type name and additional properties to ease pipelining to GitHub Repository Actions Permissions objects. + + .PARAMETER InputObject + The GitHub object to add additional properties to. + + .PARAMETER TypeName + The type that should be assigned to the object. + + .PARAMETER OwnerName + Owner of the repository. This information might be obtainable from InputObject, so this + is optional based on what InputObject contains. + + .PARAMETER RepositoryName + Name of the repository. This information might be obtainable from InputObject, so this + is optional based on what InputObject contains. + + .INPUTS + PSCustomObject + + .OUTPUTS + GitHub.RepositoryCollaborator +#> + [CmdletBinding()] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '', + Justification='Internal helper that is definitely adding more than one property.')] + param( + [Parameter( + Mandatory, + ValueFromPipeline)] + [AllowNull()] + [PSCustomObject[]] $InputObject, + + [ValidateNotNullOrEmpty()] + [string] $TypeName = $script:GitHubRepositoryActionsPermissionTypeName, + + [Parameter(Mandatory)] + [string] $OwnerName, + + [Parameter(Mandatory)] + [string] $RepositoryName + ) + + foreach ($item in $InputObject) + { + $item.PSObject.TypeNames.Insert(0, $TypeName) + + $repositoryUrl = (Join-GitHubUri -OwnerName $OwnerName -RepositoryName $RepositoryName) + + Add-Member -InputObject $item -Name 'RepositoryUrl' -Value $repositoryUrl -MemberType NoteProperty -Force + Add-Member -InputObject $item -Name 'RepositoryName' -Value $RepositoryName -MemberType NoteProperty -Force + + $allowedActionsConverter = @{ + all = 'All' + local_only = 'LocalOnly' + selected = 'Selected' + } + + if ([String]::IsNullOrEmpty($item.allowed_actions)) + { + $allowedActions = 'Disabled' + } + else + { + $allowedActions = $allowedActionsConverter[$item.allowed_actions] + } + + Add-Member -InputObject $item -Name 'AllowedActions' -Value $allowedActions -MemberType NoteProperty -Force + + Write-Output $item + } +} diff --git a/Tests/GitHubRepositories.tests.ps1 b/Tests/GitHubRepositories.tests.ps1 index d44b1da7..1ad817f6 100644 --- a/Tests/GitHubRepositories.tests.ps1 +++ b/Tests/GitHubRepositories.tests.ps1 @@ -1385,7 +1385,7 @@ try $repoName = [Guid]::NewGuid().Guid $repo = New-GitHubRepository -RepositoryName $repoName - $allowedActions = 'All', 'Local_Only', 'Selected', 'Disabled' + $allowedActions = 'All', 'LocalOnly', 'Selected', 'Disabled' } foreach ($allowedAction in $allowedActions) @@ -1406,7 +1406,7 @@ try $permissions.PSObject.TypeNames[0] | Should -Be 'GitHub.RepositoryActionsPermission' $permissions.RepositoryName | Should -Be $repoName - $permissions.RepositoryUri | Should -Be $repo.svn_url + $permissions.RepositoryUrl | Should -Be $repo.svn_url if ($allowedAction -eq 'Disabled') { @@ -1443,7 +1443,7 @@ try BeforeAll { $repo = New-GitHubRepository -RepositoryName ([Guid]::NewGuid().Guid) - $allowedActions = 'All', 'Local_Only', 'Selected', 'Disabled' + $allowedActions = 'All', 'LocalOnly', 'Selected', 'Disabled' } foreach ($allowedAction in $allowedActions) From 012d9c8a1b5772b0e64eb1c40d225ba6903cea60 Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Sat, 5 Dec 2020 16:02:44 -0800 Subject: [PATCH 5/5] Update GitHubRepositories.ps1 --- GitHubRepositories.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GitHubRepositories.ps1 b/GitHubRepositories.ps1 index 18a07205..c7a94513 100644 --- a/GitHubRepositories.ps1 +++ b/GitHubRepositories.ps1 @@ -3244,7 +3244,7 @@ filter Add-GitHubRepositoryActionsPermissionAdditionalProperties PSCustomObject .OUTPUTS - GitHub.RepositoryCollaborator + GitHub.RepositoryActionsPermission #> [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '',