Skip to content

Commit b857b0a

Browse files
🩹 [Patch]: Add ShowOutput input to action and update output script logic
1 parent a3d7834 commit b857b0a

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
A GitHub Action used for running a PowerShell Script that uses the GitHub PowerShell module.
44

5-
For more information on the available functions and automatic loaded variables, see the [GitHub PowerShell module documentation](https://psmodule.io/GitHub)
5+
For more information on the available functions and automatic loaded variables, see the
6+
[GitHub PowerShell module documentation](https://psmodule.io/GitHub)
67

78
## Usage
89

@@ -18,6 +19,7 @@ For more information on the available functions and automatic loaded variables,
1819
| `Verbose` | Enable verbose output. | false | `'false'` |
1920
| `Version` | Specifies the version of the GitHub module to be installed. The value must be an exact version. | false | |
2021
| `Prerelease` | Allow prerelease versions if available. | false | `'false'` |
22+
| `ShowOutput` | Show the output of the script. | false | `'false'` |
2123
| `WorkingDirectory` | The working directory where the script will run from. | false | `${{ github.workspace }}` |
2224

2325
### Outputs

action.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ inputs:
3434
description: Allow prerelease versions if available.
3535
required: false
3636
default: 'false'
37+
ShowOutput:
38+
description: Show the output of the script.
39+
required: false
40+
default: 'false'
3741
WorkingDirectory:
3842
description: The working directory where the script will run from.
3943
required: false
@@ -42,14 +46,14 @@ inputs:
4246
outputs:
4347
result:
4448
description: The output of the script as a JSON object. To add outputs to `result`, use `Set-GitHubOutput`.
45-
value: ${{ steps.RunGitGubScript.outputs.result }}
49+
value: ${{ steps.RunGitHubScript.outputs.result }}
4650

4751
runs:
4852
using: composite
4953
steps:
5054
- name: Install GitHub
5155
shell: pwsh
52-
id: RunGitGubScript
56+
id: RunGitHubScript
5357
working-directory: ${{ inputs.WorkingDirectory }}
5458
env:
5559
GITHUB_ACTION_INPUT_Token: ${{ inputs.Token }}
@@ -58,9 +62,10 @@ runs:
5862
GITHUB_ACTION_INPUT_Debug: ${{ inputs.Debug }}
5963
GITHUB_ACTION_INPUT_Verbose: ${{ inputs.Verbose }}
6064
GITHUB_ACTION_INPUT_Version: ${{ inputs.Version }}
65+
GITHUB_ACTION_INPUT_ShowOutput: ${{ inputs.ShowOutput }}
6166
GITHUB_ACTION_INPUT_Prerelease: ${{ inputs.Prerelease }}
6267
run: |
6368
# GitHub-Script
64-
. '${{ github.action_path }}\scripts\main.ps1'
69+
. $(Join-Path -Path '${{ github.action_path }}' -ChildPath 'scripts\main.ps1'
6570
${{ inputs.Script }}
66-
. '${{ github.action_path }}\scripts\outputs.ps1'
71+
. $(Join-Path -Path '${{ github.action_path }}' -ChildPath 'scripts\outputs.ps1'

scripts/outputs.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ param()
44
$DebugPreference = 'SilentlyContinue'
55
$VerbosePreference = 'SilentlyContinue'
66

7+
if ($env:GITHUB_ACTION_INPUT_ShowOutput -ne 'true') {
8+
return
9+
}
10+
711
$result = (Get-GitHubOutput).result
812
if (-not $result) {
913
return

0 commit comments

Comments
 (0)