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
1 change: 1 addition & 0 deletions .github/workflows/Linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ jobs:
uses: super-linter/super-linter@latest
env:
GITHUB_TOKEN: ${{ github.token }}
VALIDATE_JSCPD: false
17 changes: 17 additions & 0 deletions .github/workflows/Nightly-Run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Nightly run

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'

permissions:
contents: write
issues: write
pull-requests: write
statuses: write

jobs:
Process-PSModule:
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v1
secrets: inherit
2 changes: 1 addition & 1 deletion src/private/Gitignore/Get-GitHubGitignoreByName.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ filter Get-GitHubGitignoreByName {
[string] $Name
)

Process {
process {
$inputObject = @{
APIEndpoint = "/gitignore/templates/$Name"
Accept = 'application/vnd.github.raw+json'
Expand Down
2 changes: 1 addition & 1 deletion src/private/License/Get-GitHubLicenseByName.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ filter Get-GitHubLicenseByName {
[string] $Name
)

Process {
process {
$inputObject = @{
APIEndpoint = "/licenses/$Name"
Accept = 'application/vnd.github+json'
Expand Down
2 changes: 1 addition & 1 deletion src/private/License/Get-GitHubRepositoryLicense.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ filter Get-GitHubRepositoryLicense {
[string] $Repo = (Get-GitHubConfig -Name Repo)
)

Process {
process {
$inputObject = @{
APIEndpoint = "/repos/$Owner/$Repo/license"
Accept = 'application/vnd.github+json'
Expand Down
26 changes: 13 additions & 13 deletions src/private/Repositories/Repositories/New-GitHubRepositoryOrg.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ filter New-GitHubRepositoryOrg {
[string] $MergeCommitMessage
)

DynamicParam {
dynamicparam {
$DynamicParamDictionary = New-DynamicParamDictionary

$dynParam = @{
Expand Down Expand Up @@ -211,7 +211,7 @@ filter New-GitHubRepositoryOrg {
$LicenseTemplate = $PSBoundParameters['LicenseTemplate']
}

Process {
process {
$PSCmdlet.MyInvocation.MyCommand.Parameters.GetEnumerator() | ForEach-Object {
$paramName = $_.Key
$paramDefaultValue = Get-Variable -Name $paramName -ValueOnly -ErrorAction SilentlyContinue
Expand All @@ -231,17 +231,17 @@ filter New-GitHubRepositoryOrg {
Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner' -RemoveTypes 'SwitchParameter'

$body['private'] = $Visibility -eq 'private'
$body['has_issues'] = $HasIssues.IsPresent ? $HasIssues : $false
$body['has_wiki'] = $HasWiki.IsPresent ? $HasWiki : $false
$body['has_projects'] = $HasProjects.IsPresent ? $HasProjects : $false
$body['has_downloads'] = $HasDownloads.IsPresent ? $HasDownloads : $false
$body['is_template'] = $IsTemplate.IsPresent ? $IsTemplate : $false
$body['auto_init'] = $AutoInit.IsPresent ? $AutoInit : $false
$body['allow_squash_merge'] = $AllowSquashMerge.IsPresent ? $AllowSquashMerge : $false
$body['allow_merge_commit'] = $AllowMergeCommit.IsPresent ? $AllowMergeCommit : $false
$body['allow_rebase_merge'] = $AllowRebaseMerge.IsPresent ? $AllowRebaseMerge : $false
$body['allow_auto_merge'] = $AllowAutoMerge.IsPresent ? $AllowAutoMerge : $false
$body['delete_branch_on_merge'] = $DeleteBranchOnMerge.IsPresent ? $DeleteBranchOnMerge : $false
$body['has_issues'] = if ($HasIssues.IsPresent) { $HasIssues } else { $false }
$body['has_wiki'] = if ($HasWiki.IsPresent) { $HasWiki } else { $false }
$body['has_projects'] = if ($HasProjects.IsPresent) { $HasProjects } else { $false }
$body['has_downloads'] = if ($HasDownloads.IsPresent) { $HasDownloads } else { $false }
$body['is_template'] = if ($IsTemplate.IsPresent) { $IsTemplate } else { $false }
$body['auto_init'] = if ($AutoInit.IsPresent) { $AutoInit } else { $false }
$body['allow_squash_merge'] = if ($AllowSquashMerge.IsPresent) { $AllowSquashMerge } else { $false }
$body['allow_merge_commit'] = if ($AllowMergeCommit.IsPresent) { $AllowMergeCommit } else { $false }
$body['allow_rebase_merge'] = if ($AllowRebaseMerge.IsPresent) { $AllowRebaseMerge } else { $false }
$body['allow_auto_merge'] = if ($AllowAutoMerge.IsPresent) { $AllowAutoMerge } else { $false }
$body['delete_branch_on_merge'] = if ($DeleteBranchOnMerge.IsPresent) { $DeleteBranchOnMerge } else { $false }

Remove-HashtableEntry -Hashtable $body -NullOrEmptyValues

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ filter New-GitHubRepositoryUser {
[string] $MergeCommitMessage
)

DynamicParam {
dynamicparam {
$DynamicParamDictionary = New-DynamicParamDictionary

$dynParam = @{
Expand Down Expand Up @@ -205,7 +205,7 @@ filter New-GitHubRepositoryUser {
$LicenseTemplate = $PSBoundParameters['LicenseTemplate']
}

Process {
process {

$PSCmdlet.MyInvocation.MyCommand.Parameters.GetEnumerator() | ForEach-Object {
$paramName = $_.Key
Expand All @@ -226,17 +226,17 @@ filter New-GitHubRepositoryUser {
Remove-HashtableEntry -Hashtable $body -RemoveNames 'visibility' -RemoveTypes 'SwitchParameter'

$body['private'] = $Visibility -eq 'private'
$body['has_issues'] = $HasIssues.IsPresent ? $HasIssues : $false
$body['has_wiki'] = $HasWiki.IsPresent ? $HasWiki : $false
$body['has_projects'] = $HasProjects.IsPresent ? $HasProjects : $false
$body['has_downloads'] = $HasDownloads.IsPresent ? $HasDownloads : $false
$body['is_template'] = $IsTemplate.IsPresent ? $IsTemplate : $false
$body['auto_init'] = $AutoInit.IsPresent ? $AutoInit : $false
$body['allow_squash_merge'] = $AllowSquashMerge.IsPresent ? $AllowSquashMerge : $false
$body['allow_merge_commit'] = $AllowMergeCommit.IsPresent ? $AllowMergeCommit : $false
$body['allow_rebase_merge'] = $AllowRebaseMerge.IsPresent ? $AllowRebaseMerge : $false
$body['allow_auto_merge'] = $AllowAutoMerge.IsPresent ? $AllowAutoMerge : $false
$body['delete_branch_on_merge'] = $DeleteBranchOnMerge.IsPresent ? $DeleteBranchOnMerge : $false
$body['has_issues'] = if ($HasIssues.IsPresent) { $HasIssues } else { $false }
$body['has_wiki'] = if ($HasWiki.IsPresent) { $HasWiki } else { $false }
$body['has_projects'] = if ($HasProjects.IsPresent) { $HasProjects } else { $false }
$body['has_downloads'] = if ($HasDownloads.IsPresent) { $HasDownloads } else { $false }
$body['is_template'] = if ($IsTemplate.IsPresent) { $IsTemplate } else { $false }
$body['auto_init'] = if ($AutoInit.IsPresent) { $AutoInit } else { $false }
$body['allow_squash_merge'] = if ($AllowSquashMerge.IsPresent) { $AllowSquashMerge } else { $false }
$body['allow_merge_commit'] = if ($AllowMergeCommit.IsPresent) { $AllowMergeCommit } else { $false }
$body['allow_rebase_merge'] = if ($AllowRebaseMerge.IsPresent) { $AllowRebaseMerge } else { $false }
$body['allow_auto_merge'] = if ($AllowAutoMerge.IsPresent) { $AllowAutoMerge } else { $false }
$body['delete_branch_on_merge'] = if ($DeleteBranchOnMerge.IsPresent) { $DeleteBranchOnMerge } else { $false }

Remove-HashtableEntry -Hashtable $body -NullOrEmptyValues

Expand Down
2 changes: 1 addition & 1 deletion src/private/Utilities/Hashtable/ConvertTo-HashTable.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
[hashtable]$hashtable = @{}

foreach ($item in $InputObject.PSObject.Properties) {
$name = $NameCasingStyle ? ($item.Name | Convert-StringCasingStyle -To $NameCasingStyle) : $item.Name
$name = if ($NameCasingStyle) { ($item.Name | Convert-StringCasingStyle -To $NameCasingStyle) } else { $item.Name }
$hashtable[$name] = $item.Value
}
$hashtable
Expand Down
3 changes: 1 addition & 2 deletions src/public/Actions/Enable-GitHubWorkflow.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@
Method = 'PUT'
}

Invoke-GitHubAPI @inputObject | Out-Null

$null = Invoke-GitHubAPI @inputObject
}
2 changes: 1 addition & 1 deletion src/public/Auth/Connect-GitHubAccount.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
Write-Verbose "GitHub token: [$gitHubToken]"
$gitHubTokenPresent = $gitHubToken.count -gt 0
Write-Verbose "GitHub token present: [$gitHubTokenPresent]"
$AuthType = $gitHubTokenPresent ? 'sPAT' : $PSCmdlet.ParameterSetName
$AuthType = if ($gitHubTokenPresent) { 'sPAT' } else { $PSCmdlet.ParameterSetName }
Write-Verbose "AuthType: [$AuthType]"
switch ($AuthType) {
'DeviceFlow' {
Expand Down
4 changes: 2 additions & 2 deletions src/public/Gitignore/Get-GitHubGitignore.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ filter Get-GitHubGitignore {
[CmdletBinding(DefaultParameterSetName = 'List')]
param ()

DynamicParam {
dynamicparam {
$DynamicParamDictionary = New-DynamicParamDictionary

$dynParam = @{
Expand All @@ -43,7 +43,7 @@ filter Get-GitHubGitignore {
return $DynamicParamDictionary
}

Process {
process {
$Name = $PSBoundParameters['Name']
switch ($PSCmdlet.ParameterSetName) {
'List' {
Expand Down
4 changes: 2 additions & 2 deletions src/public/License/Get-GitHubLicense.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ filter Get-GitHubLicense {
[string] $Repo = (Get-GitHubConfig -Name Repo)
)

DynamicParam {
dynamicparam {
$DynamicParamDictionary = New-DynamicParamDictionary

$dynParam = @{
Expand All @@ -61,7 +61,7 @@ filter Get-GitHubLicense {
return $DynamicParamDictionary
}

Process {
process {
$Name = $PSBoundParameters['Name']
switch ($PSCmdlet.ParameterSetName) {
'List' {
Expand Down
4 changes: 2 additions & 2 deletions src/public/Releases/Releases/Set-GitHubRelease.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
$requestBody = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntry -Hashtable $requestBody -RemoveNames 'Owner', 'Repo', 'Draft', 'Prerelease'
$requestBody = Join-Object -AsHashtable -Main $requestBody -Overrides @{
draft = $Draft.IsPresent ? $Draft : $false
prerelease = $Prerelease.IsPresent ? $Prerelease : $false
draft = if ($Draft.IsPresent) { $Draft } else { $false }
prerelease = if ($Prerelease.IsPresent) { $Prerelease } else { $false }
}

$inputObject = @{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ filter Get-GitHubRepository {

)

DynamicParam {
dynamicparam {
$DynamicParamDictionary = New-DynamicParamDictionary

if ($PSCmdlet.ParameterSetName -in 'MyRepos_Type', 'ListByOrg', 'ListByUser') {
Expand Down Expand Up @@ -157,11 +157,11 @@ filter Get-GitHubRepository {
return $DynamicParamDictionary
}

Begin {
begin {
$Type = $PSBoundParameters['Type']
}

Process {
process {
switch ($PSCmdlet.ParameterSetName) {
'MyRepos_Type' {
$params = @{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ filter New-GitHubRepository {
[string] $MergeCommitMessage
)

DynamicParam {
dynamicparam {
$DynamicParamDictionary = New-DynamicParamDictionary

$dynParam = @{
Expand Down Expand Up @@ -327,7 +327,7 @@ filter New-GitHubRepository {
$LicenseTemplate = $PSBoundParameters['LicenseTemplate']
}

Process {
process {
if ($PSCmdlet.ParameterSetName -in 'user', 'org') {
$params = @{
Owner = $Owner
Expand Down
50 changes: 28 additions & 22 deletions src/public/Repositories/Repositories/Update-GitHubRepository.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -184,28 +184,34 @@
merge_commit_title = $MergeCommitTitle
merge_commit_message = $MergeCommitMessage

advanced_security = $EnableAdvancedSecurity.IsPresent ? @{
status = $EnableAdvancedSecurity ? 'enabled' : 'disabled'
} : $null
secret_scanning = $EnableSecretScanning.IsPresent ? @{
status = $EnableSecretScanning ? 'enabled' : 'disabled'
} : $null
secret_scanning_push_protection = $EnableSecretScanningPushProtection.IsPresent ? @{
status = $EnableSecretScanningPushProtection ? 'enabled' : 'disabled'
} : $null
has_issues = $HasIssues.IsPresent ? $HasIssues : $null
has_projects = $HasProjects.IsPresent ? $HasProjects : $null
has_wiki = $HasWiki.IsPresent ? $HasWiki : $null
is_template = $IsTemplate.IsPresent ? $IsTemplate : $null
allow_squash_merge = $AllowSquashMerge.IsPresent ? $AllowSquashMerge : $null
allow_merge_commit = $AllowMergeCommit.IsPresent ? $AllowMergeCommit : $null
allow_rebase_merge = $AllowRebaseMerge.IsPresent ? $AllowRebaseMerge : $null
allow_auto_merge = $AllowAutoMerge.IsPresent ? $AllowAutoMerge : $null
allow_update_branch = $AllowUpdateMerge.IsPresent ? $AllowUpdateMerge : $null
delete_branch_on_merge = $DeleteBranchOnMerge.IsPresent ? $DeleteBranchOnMerge : $null
archived = $Archived.IsPresent ? $Archived : $null
allow_forking = $AllowForking.IsPresent ? $AllowForking : $null
web_commit_signoff_required = $WebCommitSignoffRequired.IsPresent ? $WebCommitSignoffRequired : $null
advanced_security = if ($EnableAdvancedSecurity.IsPresent) {
@{
status = if ($EnableAdvancedSecurity) { 'enabled' } else { 'disabled' }
}
} else { $null }
secret_scanning = if ($EnableSecretScanning.IsPresent) {
@{
status = if ($EnableSecretScanning) { 'enabled' } else { 'disabled' }
}
} else { $null }
secret_scanning_push_protection = if ($EnableSecretScanningPushProtection.IsPresent) {
@{
status = if ($EnableSecretScanningPushProtection) { 'enabled' } else { 'disabled' }
}
} else { $null }
has_issues = if ($HasIssues.IsPresent) { $HasIssues } else { $null }
has_projects = if ($HasProjects.IsPresent) { $HasProjects } else { $null }
has_wiki = if ($HasWiki.IsPresent) { $HasWiki } else { $null }
is_template = if ($IsTemplate.IsPresent) { $IsTemplate } else { $null }
allow_squash_merge = if ($AllowSquashMerge.IsPresent) { $AllowSquashMerge } else { $null }
allow_merge_commit = if ($AllowMergeCommit.IsPresent) { $AllowMergeCommit } else { $null }
allow_rebase_merge = if ($AllowRebaseMerge.IsPresent) { $AllowRebaseMerge } else { $null }
allow_auto_merge = if ($AllowAutoMerge.IsPresent) { $AllowAutoMerge } else { $null }
allow_update_branch = if ($AllowUpdateMerge.IsPresent) { $AllowUpdateMerge } else { $null }
delete_branch_on_merge = if ($DeleteBranchOnMerge.IsPresent) { $DeleteBranchOnMerge } else { $null }
archived = if ($Archived.IsPresent) { $Archived } else { $null }
allow_forking = if ($AllowForking.IsPresent) { $AllowForking } else { $null }
web_commit_signoff_required = if ($WebCommitSignoffRequired.IsPresent) { $WebCommitSignoffRequired } else { $null }
}

Remove-HashtableEntry -Hashtable $body -NullOrEmptyValues
Expand Down