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
9 changes: 4 additions & 5 deletions .github/workflows/Action-Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ jobs:
uses: ./
id: action-test
with:
WorkingDirectory: tests/srcTestRepo
Path: src
Settings: SourceCode
WorkingDirectory: tests/srcTestRepo

- name: Status
shell: pwsh
Expand All @@ -55,10 +55,10 @@ jobs:
uses: ./
id: action-test
with:
WorkingDirectory: tests/srcTestRepo
Path: src
Settings: Custom
SettingsFilePath: tests/Custom.Settings.psd1
WorkingDirectory: tests/srcTestRepo

- name: Status
shell: pwsh
Expand All @@ -81,9 +81,9 @@ jobs:
continue-on-error: true
id: action-test
with:
WorkingDirectory: tests/srcWithManifestTestRepo
Path: src
Settings: SourceCode
WorkingDirectory: tests/srcWithManifestTestRepo

- name: Status
shell: pwsh
Expand All @@ -105,9 +105,9 @@ jobs:
uses: ./
id: action-test
with:
WorkingDirectory: tests/outputTestRepo
Path: outputs/modules/PSModuleTest
Settings: Module
WorkingDirectory: tests/outputTestRepo

- name: Status
shell: pwsh
Expand Down Expand Up @@ -229,4 +229,3 @@ jobs:
Write-GitHubError 'One or more jobs failed'
exit 1
}

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
- name: Invoke PSScriptAnalyzer
uses: PSModule/Invoke-ScriptAnalyzer@v2
with:
Path: ${{ github.workspace }}
Path: src
Settings: SourceCode
```

Expand Down
5 changes: 3 additions & 2 deletions scripts/main.ps1
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# If test type is module, the code we ought to test is in the path/name folder, otherwise it's in the path folder.
$settings = $env:PSMODULE_INVOKE_SCRIPTANALYZER_INPUT_Settings
$testPath = Resolve-Path -Path "$PSScriptRoot/tests/PSScriptAnalyzer" | Select-Object -ExpandProperty Path
$codePath = Resolve-Path -Path $env:PSMODULE_INVOKE_SCRIPTANALYZER_INPUT_Path | Select-Object -ExpandProperty Path
$path = [string]::IsNullOrEmpty($env:PSMODULE_INVOKE_SCRIPTANALYZER_INPUT_Path) ? '.' : $env:PSMODULE_INVOKE_SCRIPTANALYZER_INPUT_Path
$codePath = Resolve-Path -Path $path | Select-Object -ExpandProperty Path
$settingsFilePath = switch -Regex ($settings) {
'Module|SourceCode' {
"$testPath/$settings.Settings.psd1"
}
'Custom' {
Resolve-Path -Path "$env:PSMODULE_INVOKE_SCRIPTANALYZER_INPUT_SettingsFilePath" | Select-Object -ExpandProperty Path
Resolve-Path -Path $env:PSMODULE_INVOKE_SCRIPTANALYZER_INPUT_SettingsFilePath | Select-Object -ExpandProperty Path
}
default {
throw "Invalid test type: [$settings]"
Expand Down
Loading