Skip to content

Commit db7c2d5

Browse files
Enhance action.yml and main.ps1 with additional input parameters and improved variable handling
1 parent e31fd92 commit db7c2d5

File tree

2 files changed

+52
-31
lines changed

2 files changed

+52
-31
lines changed

action.yml

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,48 @@
1-
name: '{{ NAME }}'
2-
description: '{{ DESCRIPTION }}'
1+
name: {{ NAME }}
2+
description: {{ DESCRIPTION }}
33
author: PSModule
44
branding:
55
icon: upload-cloud
66
color: white
77

88
inputs:
9-
working-directory:
10-
description: The working directory where Terraform will be executed
11-
required: false
129
subject:
1310
description: The subject to greet
1411
required: false
1512
default: World
13+
Debug:
14+
description: Enable debug output.
15+
required: false
16+
default: 'false'
17+
Verbose:
18+
description: Enable verbose output.
19+
required: false
20+
default: 'false'
21+
Version:
22+
description: Specifies the version of the GitHub module to be installed. The value must be an exact version.
23+
required: false
24+
Prerelease:
25+
description: Allow prerelease versions if available.
26+
required: false
27+
default: 'false'
28+
WorkingDirectory:
29+
description: The working directory where the script will run from.
30+
required: false
31+
default: ${{ github.workspace }}
1632

1733
runs:
1834
using: composite
1935
steps:
20-
- name: '{{ NAME }}'
36+
- name: {{ NAME }}
2137
uses: PSModule/GitHub-Script@v1
2238
env:
2339
{{ ORG }}_{{ NAME }}_INPUT_subject: ${{ inputs.subject }}
2440
with:
41+
Debug: ${{ inputs.Debug }}
42+
Prerelease: ${{ inputs.Prerelease }}
43+
Verbose: ${{ inputs.Verbose }}
44+
Version: ${{ inputs.Version }}
45+
WorkingDirectory: ${{ inputs.WorkingDirectory }}
2546
Script: |
26-
# '{{ NAME }}'
47+
# {{ NAME }}
2748
${{ github.action_path }}/scripts/main.ps1

scripts/main.ps1

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
#Requires -Modules GitHub
2-
3-
[CmdletBinding()]
4-
param(
5-
[Parameter()]
6-
[string] $Subject = $env:GITHUB_ACTION_INPUT_subject
7-
)
8-
9-
begin {
10-
$scriptName = $MyInvocation.MyCommand.Name
11-
Write-Debug "[$scriptName] - Start"
12-
}
13-
14-
process {
15-
try {
16-
Write-Output "Hello, $Subject!"
17-
} catch {
18-
throw $_
19-
}
20-
}
21-
22-
end {
23-
Write-Debug "[$scriptName] - End"
24-
}
1+
#Requires -Modules GitHub
2+
3+
[CmdletBinding()]
4+
param(
5+
[Parameter()]
6+
[string] $Subject = $env:<ORG_NAME>_<REPO_NAME>_INPUT_subject
7+
)
8+
9+
begin {
10+
$scriptName = $MyInvocation.MyCommand.Name
11+
Write-Debug "[$scriptName] - Start"
12+
}
13+
14+
process {
15+
try {
16+
Write-Output "Hello, $Subject!"
17+
} catch {
18+
throw $_
19+
}
20+
}
21+
22+
end {
23+
Write-Debug "[$scriptName] - End"
24+
}

0 commit comments

Comments
 (0)