Skip to content

Commit a097f53

Browse files
Refactor action.yml to simplify input parameters and update main.ps1 to enhance logging with Write-Host for GitHub Actions
1 parent 978058d commit a097f53

File tree

2 files changed

+11
-37
lines changed

2 files changed

+11
-37
lines changed

action.yml

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,11 @@ branding:
55
icon: upload-cloud
66
color: white
77

8-
inputs:
9-
Debug:
10-
description: Enable debug output.
11-
required: false
12-
default: 'false'
13-
Verbose:
14-
description: Enable verbose output.
15-
required: false
16-
default: 'false'
17-
Version:
18-
description: Specifies the version of the GitHub module to be installed. The value must be an exact version.
19-
required: false
20-
Prerelease:
21-
description: Allow prerelease versions if available.
22-
required: false
23-
default: 'false'
24-
WorkingDirectory:
25-
description: The working directory where the script will run from.
26-
required: false
27-
default: '.'
28-
298
runs:
309
using: composite
3110
steps:
3211
- name: Install-PSModuleHelpers
33-
uses: PSModule/GitHub-Script@v1
34-
with:
35-
ShowInfo: false
36-
Debug: ${{ inputs.Debug }}
37-
Prerelease: ${{ inputs.Prerelease }}
38-
Verbose: ${{ inputs.Verbose }}
39-
Version: ${{ inputs.Version }}
40-
WorkingDirectory: ${{ inputs.WorkingDirectory }}
41-
Script: |
42-
# Install-PSModuleHelpers
43-
${{ github.action_path }}/scripts/main.ps1
12+
shell: pwsh
13+
run: |
14+
# Install-PSModuleHelpers
15+
${{ github.action_path }}/scripts/main.ps1

scripts/main.ps1

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
#Requires -Modules GitHub
2-
1+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
2+
'PSAvoidUsingWriteHost', '',
3+
Justification = 'Wriite to the GitHub Actions log, not the pipeline.'
4+
)]
35
[CmdletBinding()]
46
param()
57

@@ -9,6 +11,6 @@ Get-Command -Module Helpers | ForEach-Object { Remove-Item -Path function:$_ -Fo
911
Get-Item -Path "$PSModulePath/Helpers/999.0.0" -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force
1012
$modulePath = New-Item -Path "$PSModulePath/Helpers/999.0.0" -ItemType Directory -Force | Select-Object -ExpandProperty FullName
1113
Copy-Item -Path "$PSScriptRoot/Helpers/*" -Destination $modulePath -Recurse -Force
12-
LogGroup 'Importing helpers' {
13-
Import-Module -Name Helpers -Verbose
14-
}
14+
Write-Host '::group::Importing helpers'
15+
Import-Module -Name Helpers -Verbose
16+
Write-Host '::endgroup::'

0 commit comments

Comments
 (0)