Skip to content

.Platform - Toggle AVM workflows #3

.Platform - Toggle AVM workflows

.Platform - Toggle AVM workflows #3

name: .Platform - Toggle AVM workflows
on:
workflow_dispatch:
inputs:
targetState:
type: choice
description: "Enable or disable workflows"
required: true
options:
- "Enable"
- "Disable"
default: "Disable"
includePattern:
type: string
description: "RegEx which workflows are included"
required: false
default: "avm\\.(?:res|ptn)"
excludePattern:
type: string
description: "RegEx which workflows are excluded"
required: false
default: "^$"
jobs:
toggle-avm-workflows:
if: github.repository != 'Azure/bicep-registry-modules'
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
fetch-depth: 0
- env:
GH_TOKEN: ${{ github.token }}
name: ${{ inputs.targetState }} AVM workflows
shell: pwsh
run: |
# Load used functions
. (Join-Path $env:GITHUB_WORKSPACE 'avm' 'utilities' 'pipelines' 'platform' 'Switch-WorkflowState.ps1')
$functionInput = @{
RepositoryOwner = '${{ github.repository_owner }}'
RepositoryName = '${{ github.event.repository.name }}'
TargetState = '${{ inputs.targetState }}'.ToLower()
IncludePattern = '${{ inputs.includePattern }}'
ExlcudePattern = '${{ inputs.excludePattern }}'
}
Write-Verbose "Invoke function with" -Verbose
Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose
# Get the modified child resources
Switch-WorkflowState @functionInput -Verbose