Skip to content

Commit ef5b0ee

Browse files
author
James Brundage
committed
fix: ugit action checking before -InstallModule ( Fixes #290 )
Also, importing from workspace if found
1 parent f44fc16 commit ef5b0ee

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

Build/GitHub/Actions/UGitAction.ps1

+6-1
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,13 @@ function InstallActionModule {
9292
$(Get-Content $_.FullName -Raw) -match 'ModuleVersion'
9393
}
9494
if (-not $moduleInWorkspace) {
95-
Install-Module $moduleToInstall -Scope CurrentUser -Force
95+
$availableModules = Get-Module -ListAvailable
96+
if ($availableModules.Name -notcontains $moduleToInstall) {
97+
Install-Module $moduleToInstall -Scope CurrentUser -Force -AcceptLicense -AllowClobber
98+
}
9699
Import-Module $moduleToInstall -Force -PassThru | Out-Host
100+
} else {
101+
Import-Module $moduleInWorkspace.FullName -Force -PassThru | Out-Host
97102
}
98103
}
99104
function ImportActionModule {

action.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,13 @@ runs:
185185
$(Get-Content $_.FullName -Raw) -match 'ModuleVersion'
186186
}
187187
if (-not $moduleInWorkspace) {
188-
Install-Module $moduleToInstall -Scope CurrentUser -Force
188+
$availableModules = Get-Module -ListAvailable
189+
if ($availableModules.Name -notcontains $moduleToInstall) {
190+
Install-Module $moduleToInstall -Scope CurrentUser -Force -AcceptLicense -AllowClobber
191+
}
189192
Import-Module $moduleToInstall -Force -PassThru | Out-Host
193+
} else {
194+
Import-Module $moduleInWorkspace.FullName -Force -PassThru | Out-Host
190195
}
191196
}
192197
function ImportActionModule {

0 commit comments

Comments
 (0)