-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
52 lines (49 loc) · 1.87 KB
/
action.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
name: IIS Application Pool Action
description: This action can restart, start or stop an IIS application pool, or get information about its state.
inputs:
action:
description: Specify get-state, restart, start, stop as the action to perform
type: choice
options:
- get-state
- restart
- start
- stop
required: true
appPoolName:
description: IIS application pool name
required: true
siteName:
description: IIS site name
required: true
outputs:
appPoolName:
description: Application pool name
value: ${{ steps.iis_application_pool.outputs.appPoolName }}
state:
description: Application pool state
value: ${{ steps.iis_application_pool.outputs.state }}
runs:
using: composite
steps:
- name: Set IIS app pool name
id: set_app_pool_name
shell: powershell
run: |
if ("${{ inputs.appPoolName }}" -ne ""){
Write-Output "appPoolName=${{ inputs.appPoolName }}" >> $ENV:GITHUB_OUTPUT
} elseif ("${{ inputs.appPoolName }}" -eq "" -And "${{ inputs.siteName }}" -ne "") {
$s = Get-IISSite -Name "${{ inputs.siteName }}" -WarningAction:SilentlyContinue
if ($null -eq "$s") {
Write-Host "IIS site $SiteName does not exist"
exit 1
}
$p = ((Get-IISSite -Name "${{ inputs.siteName }}").Applications | Where-Object {$_.Path -eq "/" }).ApplicationPoolName
Write-Output "appPoolName=$p" >> $ENV:GITHUB_OUTPUT
} else {
Write-Host "You should fill one of these variables: 'appPoolName' or 'siteName'."
}
- name: IIS application pool
id: iis_application_pool
shell: powershell
run: ${{ github.action_path }}/ApplicationPool.ps1 -Action "${{ inputs.action }}" -AppPoolName "${{ steps.set_app_pool_name.outputs.appPoolName }}"