File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -1049,6 +1049,9 @@ filter Set-GitHubRepository
10491049 . PARAMETER DefaultBranch
10501050 Update the default branch for this repository.
10511051
1052+ . PARAMETER SecretScanning
1053+ Specifies whether to enable or disable secret scanning for the repository.
1054+
10521055 . PARAMETER Private
10531056 Specify this to make the repository private.
10541057 To change a repository to be public, specify -Private:$false
@@ -1177,6 +1180,9 @@ filter Set-GitHubRepository
11771180
11781181 [string ] $DefaultBranch ,
11791182
1183+ [ValidateSet (' Enabled' , ' Disabled' )]
1184+ [string ] $SecretScanning ,
1185+
11801186 [switch ] $Private ,
11811187
11821188 [switch ] $NoIssues ,
@@ -1251,6 +1257,14 @@ filter Set-GitHubRepository
12511257 if ($PSBoundParameters.ContainsKey (' WebCommitSignoffRequired' )) { $hashBody [' web_commit_signoff_required' ] = $WebCommitSignoffRequired.ToBool () }
12521258 if ($PSBoundParameters.ContainsKey (' Archived' )) { $hashBody [' archived' ] = $Archived.ToBool () }
12531259
1260+ $securityAndAnalysis = @ {}
1261+ if ($PSBoundParameters.ContainsKey (' SecretScanning' )) {
1262+ $securityAndAnalysis [' secret_scanning' ] = @ { ' status' = $SecretScanning.ToLower ()}
1263+ }
1264+ if ($securityAndAnalysis.Count -ne 0 ) {
1265+ $hashBody [' security_and_analysis' ] = $securityAndAnalysis
1266+ }
1267+
12541268 if ($Force -and (-not $Confirm ))
12551269 {
12561270 $ConfirmPreference = ' None'
Original file line number Diff line number Diff line change @@ -723,6 +723,27 @@ Describe 'GitHubRepositories\Set-GitHubRepository' {
723723 $repo = New-GitHubRepository - RepositoryName $repoName
724724 }
725725
726+ Context - Name ' When updating a public repository with Secret Scanning' {
727+ BeforeAll - ScriptBlock {
728+ $updateGithubRepositoryParms = @ {
729+ OwnerName = $repo.owner.login
730+ RepositoryName = $repoName
731+ SecretScanning = ' Enabled'
732+ }
733+
734+ $updatedRepo = Set-GitHubRepository @updateGithubRepositoryParms - PassThru
735+ }
736+
737+ It ' Should return an object of the correct type' {
738+ $updatedRepo | Should - BeOfType PSCustomObject
739+ }
740+
741+ It ' Should return the correct properties' {
742+ $updatedRepo.name | Should - Be $repoName
743+ $updatedRepo.security_and_analysis.secret_scanning.status | Should - Be ' enabled'
744+ }
745+ }
746+
726747 Context - Name ' When updating a public repository with auto-merge set to true' {
727748 BeforeAll - ScriptBlock {
728749 $updateGithubRepositoryParms = @ {
You can’t perform that action at this time.
0 commit comments