Public/Invoke-MkCi.ps1

function Invoke-MkCi {
    <#
    .SYNOPSIS
    Creates a minimal CI/CD pipeline skeleton file.

    .DESCRIPTION
    Generates provider-specific CI skeletons for GitHub Actions, Azure Pipelines, or GitLab CI.
    Parent folders are created as needed. Existing files are not overwritten unless -Force is used.

    .PARAMETER Provider
    CI provider to scaffold. Supported values: GitHub, Azure, GitLab.

    .PARAMETER Force
    Overwrites CI file if it already exists.

    .EXAMPLE
    mkci -Provider GitHub
    #>

    [CmdletBinding(SupportsShouldProcess = $true)]
    [OutputType([System.IO.FileInfo])]
    [Alias('mkci')]
    param(
        [Parameter(Mandatory = $true)]
        [ValidateSet('GitHub', 'Azure', 'GitLab')]
        [string]$Provider,

        [switch]$Force
    )

    $cwd = Get-Location
    $path = $null
    $content = $null

    switch ($Provider) {
        'GitHub' {
            $workflowDir = Join-Path -Path $cwd -ChildPath '.github/workflows'
            $path = Join-Path -Path $workflowDir -ChildPath 'main.yml'
            $content = @"
name: ci

on:
  push:
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - name: TODO build
        run: echo "TODO: add build/test steps"
"@

        }
        'Azure' {
            $path = Join-Path -Path $cwd -ChildPath '.azure-pipelines.yml'
            $content = @"
trigger:
- main

pool:
  vmImage: ubuntu-latest

steps:
- checkout: self
- script: echo "TODO: add build/test steps"
  displayName: TODO build
"@

        }
        'GitLab' {
            $path = Join-Path -Path $cwd -ChildPath '.gitlab-ci.yml'
            $content = @"
stages:
  - build

build:
  stage: build
  script:
    - echo "TODO: add build/test steps"
"@

        }
    }

    if (-not $PSCmdlet.ShouldProcess($path, 'Write CI scaffold')) {
        return
    }

    Set-DtFileContent -Path $path -Content $content -Force:$Force -Confirm:$false | Out-Null

    if (Test-Path -LiteralPath $path) {
        [System.IO.FileInfo]::new($path)
    }
}