forked from Azure/bicep-registry-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (49 loc) · 1.66 KB
/
platform.toggle-avm-workflows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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|utl)"
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 '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