Skip to content

Commit

Permalink
create repo tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnDuprey committed Feb 12, 2025
1 parent 785e3cc commit 5168300
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Modules/CippExtensions/Public/GitHub/New-GitHubRepo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,21 @@ function New-GitHubRepo {
$Body = @{
name = $Name
description = $Description
private = $Private
private = $Private.IsPresent
license_template = $License
}

if ($Type -eq 'Org') {
$Path = "orgs/$Org/repos"
$Owner = $Org
} else {
$Path = 'user/repos'
$Owner = (Invoke-GitHubApiRequest -Path 'user').login
}

# Check if repo exists
try {
$Existing = Invoke-GitHubApiRequest -Path "$Path/$Name"
$Existing = Invoke-GitHubApiRequest -Path "repos/$Owner/$Name"
if ($Existing.id) {
return $Existing
}
Expand Down

0 comments on commit 5168300

Please sign in to comment.