Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ To get started with your own GitHub PowerShell based action, [create a new repos
| `Verbose` | Enable verbose output. | false | `'false'` |
| `Version` | Specifies the exact version of the GitHub module to install. | false | |
| `Prerelease` | Allow prerelease versions if available. | false | `'false'` |
| `ErrorView` | Configure the PowerShell `$ErrorView` variable. You can use full names ('NormalView', 'CategoryView', 'ConciseView', 'DetailedView'). It matches on partials. | false | `'NormalView'` |
| `ShowInfo` | Show information about the environment. | false | `'true'` |
| `ShowInit` | Show information about the initialization. | false | `'false'` |
| `ShowOutput` | Show the script's output. | false | `'false'` |
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ inputs:
description: Show the output of the script.
required: false
default: 'false'
ErrorView:
description: Configure the PowerShell `$ErrorView` variable. You can use full names ('NormalView', 'CategoryView', 'ConciseView', 'DetailedView'). It matches on partials.
required: false
default: 'NormalView'
WorkingDirectory:
description: The working directory where the script will run from.
required: false
Expand Down Expand Up @@ -79,6 +83,7 @@ runs:
PSMODULE_GITHUB_SCRIPT_INPUT_ShowInfo: ${{ inputs.ShowInfo }}
PSMODULE_GITHUB_SCRIPT_INPUT_ShowOutput: ${{ inputs.ShowOutput }}
PSMODULE_GITHUB_SCRIPT_INPUT_Prerelease: ${{ inputs.Prerelease }}
PSMODULE_GITHUB_SCRIPT_INPUT_ErrorView: ${{ inputs.ErrorView }}
run: |
# ${{ inputs.Name }}
try {
Expand Down
16 changes: 16 additions & 0 deletions scripts/init.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ begin {
$scriptName = $MyInvocation.MyCommand.Name
Write-Debug "[$scriptName] - Start"
$PSStyle.OutputRendering = 'Ansi'

# Configure ErrorView based on input parameter
if (-not [string]::IsNullOrEmpty($env:PSMODULE_GITHUB_SCRIPT_INPUT_ErrorView)) {
$validViews = @('NormalView', 'CategoryView', 'ConciseView', 'DetailedView')
$errorViewSetting = $env:PSMODULE_GITHUB_SCRIPT_INPUT_ErrorView

# Simply find the first validView that matches the input using wildcards
$matchedView = $validViews | Where-Object { $_ -like "*$errorViewSetting*" } | Select-Object -First 1

if ($matchedView) {
Write-Debug "[$scriptName] - Input [$errorViewSetting] matched with [$matchedView]"
$ErrorView = $matchedView
} else {
Write-Warning "[$scriptName] - Invalid ErrorView value: [$errorViewSetting]. Using default."
}
}
}

process {
Expand Down
Loading