.Platform - Toggle AVM workflows #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |