Skip to content

Commit bd01dd0

Browse files
🩹 [Refactor]: Update action.yml to add WorkingDirectory input and streamline artifact path handling
1 parent 67afbe5 commit bd01dd0

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

‎action.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,10 @@ inputs:
99
Name:
1010
description: Name of the module to process.
1111
required: false
12-
Path:
13-
description: Path to the folder where the modules are located.
14-
required: false
15-
default: ${{ github.workspace }}
1612
ArtifactName:
1713
description: Name of the artifact to upload.
1814
required: false
19-
default: 'module'
15+
default: module
2016
Debug:
2117
description: Enable debug output.
2218
required: false
@@ -32,6 +28,10 @@ inputs:
3228
description: Allow prerelease versions if available.
3329
required: false
3430
default: 'false'
31+
WorkingDirectory:
32+
description: The working directory where the script will run from.
33+
required: false
34+
default: ${{ github.workspace }}
3535

3636
runs:
3737
using: composite
@@ -41,12 +41,12 @@ runs:
4141
id: build
4242
env:
4343
PSMODULE_BUILD_PSMODULE_INPUT_Name: ${{ inputs.Name }}
44-
PSMODULE_BUILD_PSMODULE_INPUT_Path: ${{ inputs.Path }}
4544
with:
4645
Debug: ${{ inputs.Debug }}
4746
Prerelease: ${{ inputs.Prerelease }}
4847
Verbose: ${{ inputs.Verbose }}
4948
Version: ${{ inputs.Version }}
49+
WorkingDirectory: ${{ inputs.WorkingDirectory }}
5050
Script: |
5151
# Build-PSModule
5252
${{ github.action_path }}/scripts/main.ps1
@@ -55,6 +55,6 @@ runs:
5555
uses: actions/upload-artifact@v4
5656
with:
5757
name: ${{ inputs.ArtifactName }}
58-
path: ${{ inputs.Path }}/outputs/module
58+
path: ${{ inputs.WorkingDirectory }}/outputs/module
5959
if-no-files-found: error
6060
retention-days: 1

‎scripts/helpers/Build-PSModule.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
Build-PSModuleBase -ModuleName $ModuleName -ModuleSourceFolder $moduleSourceFolder -ModuleOutputFolder $moduleOutputFolder
4343
Build-PSModuleManifest -ModuleName $ModuleName -ModuleOutputFolder $moduleOutputFolder
4444
Build-PSModuleRootModule -ModuleName $ModuleName -ModuleOutputFolder $moduleOutputFolder
45-
Update-PSModuleManifestAliasesToExport -ModuleName $ModuleName -ModuleOutputFolder $moduleOutputFolder # TODO: Use AST to find aliases to export.
45+
Update-PSModuleManifestAliasesToExport -ModuleName $ModuleName -ModuleOutputFolder $moduleOutputFolder
4646

4747
LogGroup 'Build manifest file - Final Result' {
4848
$outputManifestPath = Join-Path -Path $ModuleOutputFolder -ChildPath "$ModuleName.psd1"

‎scripts/main.ps1

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ LogGroup 'Loading inputs' {
2424
Write-Host "Module name: [$moduleName]"
2525
Set-GitHubOutput -Name ModuleName -Value $moduleName
2626

27-
$sourceFolderPath = Join-Path -Path $env:PSMODULE_BUILD_PSMODULE_INPUT_Path -ChildPath 'src'
28-
if (-not (Test-Path -Path $sourceFolderPath)) {
29-
throw "Source folder path [$sourceFolderPath] does not exist."
30-
}
31-
32-
$moduleOutputFolderPath = Join-Path $env:PSMODULE_BUILD_PSMODULE_INPUT_Path -ChildPath 'outputs/module'
27+
$sourceFolderPath = Resolve-Path -Path 'src' | Select-Object -ExpandProperty Path
28+
$moduleOutputFolderPath = Join-Path . -ChildPath 'outputs/module'
3329
Write-Host "Modules output path: [$moduleOutputFolderPath]"
30+
[pscustomobject]@{
31+
moduleName = $moduleName
32+
sourceFolderPath = $sourceFolderPath
33+
moduleOutputFolderPath = $moduleOutputFolderPath
34+
} | Format-List
3435
}
3536

3637
LogGroup 'Build local scripts' {

0 commit comments

Comments
 (0)