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
1049
1049
. PARAMETER DefaultBranch
1050
1050
Update the default branch for this repository.
1051
1051
1052
+ . PARAMETER SecretScanning
1053
+ Specifies whether to enable or disable secret scanning for the repository.
1054
+
1052
1055
. PARAMETER Private
1053
1056
Specify this to make the repository private.
1054
1057
To change a repository to be public, specify -Private:$false
@@ -1177,6 +1180,9 @@ filter Set-GitHubRepository
1177
1180
1178
1181
[string ] $DefaultBranch ,
1179
1182
1183
+ [ValidateSet (' Enabled' , ' Disabled' )]
1184
+ [string ] $SecretScanning ,
1185
+
1180
1186
[switch ] $Private ,
1181
1187
1182
1188
[switch ] $NoIssues ,
@@ -1251,6 +1257,14 @@ filter Set-GitHubRepository
1251
1257
if ($PSBoundParameters.ContainsKey (' WebCommitSignoffRequired' )) { $hashBody [' web_commit_signoff_required' ] = $WebCommitSignoffRequired.ToBool () }
1252
1258
if ($PSBoundParameters.ContainsKey (' Archived' )) { $hashBody [' archived' ] = $Archived.ToBool () }
1253
1259
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
+
1254
1268
if ($Force -and (-not $Confirm ))
1255
1269
{
1256
1270
$ConfirmPreference = ' None'
Original file line number Diff line number Diff line change @@ -723,6 +723,27 @@ Describe 'GitHubRepositories\Set-GitHubRepository' {
723
723
$repo = New-GitHubRepository - RepositoryName $repoName
724
724
}
725
725
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
+
726
747
Context - Name ' When updating a public repository with auto-merge set to true' {
727
748
BeforeAll - ScriptBlock {
728
749
$updateGithubRepositoryParms = @ {
You can’t perform that action at this time.
0 commit comments