Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💡[Idea]: GitHub DSL/IaC #125

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
49 changes: 49 additions & 0 deletions tools/utilities/IaC.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

function Repository {
param(
[string] $Name,
[hashtable] $InputObject
)
$exists = Get-GitHubRepository

if ($exists) {
Set-GitHubRepository -WhatIf:$WhatIf
} else {
New-GitHubRepository -WhatIf:$WhatIf
}

$repo = Get-GitHubRepository
New-Variable -Name $Name -Value $repo -Scope Script -Force

if ($Destroy) {
Delete-GitHubRepository -WhatIf:$WhatIf
}
}

function RuleSet {
param(
[string] $Name,
[hashtable] $Rules
)
Write-Host "Creating RuleSet $Name"
$Rules
}

Repository 'MyRepo' @{
Name = 'MyRepo'
Description = 'MyRepo Description'
Visibility = 'public'
HasIssues = $true
RuleSets = @{
Default = RuleSet @{
Name = 'Default'
Rules = @{
rule1 = @{
'rule1' = 'rule1'
}
}
}
}
}

$MyRepo
Loading