Skip to content

Commit cc12067

Browse files
🪲 [Fix]: Fix debug and verbose inputs (#61)
This pull request introduces updates to improve debug and verbose output handling across the GitHub PowerShell-based action. The changes ensure consistent configuration of debug and verbose preferences and enhance clarity in documentation and workflow files. ### Debug and Verbose Output Handling Updates: * [`.github/workflows/TestWorkflow.yml`](diffhunk://#diff-242a265d6d6bfff6094c9285345022d0e6d7ddde58504dfc80249fafbd89ba2cL412-R412): Added the `-Debug` parameter to the `Get-GitHubUser` command to enable debug output during the workflow execution. * [`action.yml`](diffhunk://#diff-1243c5424efaaa19bd8e813c5e6f6da46316e63761421b3e5f5c8ced9a36e6b6L27-R31): Updated the descriptions for `Debug` and `Verbose` inputs to clarify that they enable debug and verbose output for the entire action. Additionally, configured `$DebugPreference` and `$VerbosePreference` based on input values to set PowerShell preferences dynamically. [[1]](diffhunk://#diff-1243c5424efaaa19bd8e813c5e6f6da46316e63761421b3e5f5c8ced9a36e6b6L27-R31) [[2]](diffhunk://#diff-1243c5424efaaa19bd8e813c5e6f6da46316e63761421b3e5f5c8ced9a36e6b6R95-R96) * [`scripts/info.ps1`](diffhunk://#diff-82c586f67d16e32953b47a962c269d0a484f8aa660d71ad354e91fd2d4334cd9L63-L64): Removed redundant `$DebugPreference` and `$VerbosePreference` configuration from the `end` block, as these preferences are now set globally in the action runner. * [`scripts/outputs.ps1`](diffhunk://#diff-ee715ca93229232e95883bf00629fd14e3bf174cdc17b723c4cc5d70e6a60a58L6-L7): Removed hardcoded `$DebugPreference` and `$VerbosePreference` settings to align with the new dynamic configuration approach. ### Documentation Updates: * [`README.md`](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L18-R19): Improved descriptions for `Debug` and `Verbose` inputs to specify that they enable output for the entire action, enhancing clarity for users.
1 parent 8afae86 commit cc12067

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

.github/workflows/TestWorkflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ jobs:
409409
Prerelease: ${{ inputs.Prerelease }}
410410
Script: |
411411
LogGroup 'Get-GitHubUser' {
412-
Get-GitHubUser | Format-Table -AutoSize | Out-String
412+
Get-GitHubUser -Debug | Format-Table -AutoSize | Out-String
413413
}
414414
415415
LogGroup 'Get-GitHubOrganization' {

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ To get started with your own GitHub PowerShell based action, [create a new repos
1515
| `Token` | Log in using an Installation Access Token (IAT). | false | `${{ github.token }}` |
1616
| `ClientID` | Log in using a GitHub App, with the App's Client ID and Private Key. | false | |
1717
| `PrivateKey` | Log in using a GitHub App, with the App's Client ID and Private Key. | false | |
18-
| `Debug` | Enable debug output. | false | `'false'` |
19-
| `Verbose` | Enable verbose output. | false | `'false'` |
18+
| `Debug` | Enable debug output for the whole action. | false | `'false'` |
19+
| `Verbose` | Enable verbose output for the whole action. | false | `'false'` |
2020
| `Version` | Specifies the exact version of the GitHub module to install. | false | |
2121
| `Prerelease` | Allow prerelease versions if available. | false | `'false'` |
2222
| `ErrorView` | Configure the PowerShell `$ErrorView` variable. You can use full names ('NormalView', 'CategoryView', 'ConciseView', 'DetailedView'). It matches on partials. | false | `'NormalView'` |

action.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ inputs:
2424
description: Log in using a GitHub App, using the App's Client ID and Private Key.
2525
required: false
2626
Debug:
27-
description: Enable debug output.
27+
description: Enable debug output for the whole action.
2828
required: false
2929
default: 'false'
3030
Verbose:
31-
description: Enable verbose output.
31+
description: Enable verbose output for the whole action.
3232
required: false
3333
default: 'false'
3434
Version:
@@ -92,6 +92,8 @@ runs:
9292
run: |
9393
# ${{ inputs.Name }}
9494
$ErrorView = $env:PSMODULE_GITHUB_SCRIPT_INPUT_ErrorView
95+
$DebugPreference = $env:PSMODULE_GITHUB_SCRIPT_INPUT_Debug -eq 'true' ? 'Continue' : 'SilentlyContinue'
96+
$VerbosePreference = $env:PSMODULE_GITHUB_SCRIPT_INPUT_Verbose -eq 'true' ? 'Continue' : 'SilentlyContinue'
9597
try {
9698
${{ github.action_path }}/scripts/init.ps1
9799
${{ github.action_path }}/scripts/info.ps1

scripts/info.ps1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,4 @@ process {
6060

6161
end {
6262
Write-Debug "[$scriptName] - End"
63-
$DebugPreference = $env:PSMODULE_GITHUB_SCRIPT_INPUT_Debug -eq 'true' ? 'Continue' : 'SilentlyContinue'
64-
$VerbosePreference = $env:PSMODULE_GITHUB_SCRIPT_INPUT_Verbose -eq 'true' ? 'Continue' : 'SilentlyContinue'
6563
}

scripts/outputs.ps1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
[CmdletBinding()]
44
param()
55

6-
$DebugPreference = 'SilentlyContinue'
7-
$VerbosePreference = 'SilentlyContinue'
86
$scriptName = $MyInvocation.MyCommand.Name
97
Write-Debug "[$scriptName] - Start"
108

0 commit comments

Comments
 (0)