Skip to content

Commit 6c75642

Browse files
🩹 [Patch]: Added param for shell type (#15)
## Description - Added param for `shell` type, as a step to test with multiple os and Powershell core + desktop. ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] 📖 [Docs] - [ ] 🪲 [Fix] - [x] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [ ] 🚀 [Feature] - [ ] 🌟 [Breaking change] ## Checklist <!-- Use the check-boxes [x] on the options that are relevant. --> - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas
1 parent 2a9d893 commit 6c75642

File tree

5 files changed

+55
-9
lines changed

5 files changed

+55
-9
lines changed

.github/workflows/Action-Test.yml

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,63 @@ on: [pull_request]
66

77
jobs:
88
ActionTestDefault:
9-
name: Action-Test - [Default]
10-
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
shell: [pwsh]
13+
os: [ubuntu-latest, macos-latest, windows-latest]
14+
include:
15+
- shell: powershell
16+
os: windows-latest
17+
name: Action-Test - [Default] - [${{ matrix.os }}@${{ matrix.shell }}]
18+
runs-on: ${{ matrix.os }}
1119
steps:
1220
- name: Checkout repo
1321
uses: actions/checkout@v4
1422

1523
- name: Action-Test
1624
uses: ./
25+
with:
26+
Shell: ${{ matrix.shell }}
1727

1828
ActionTestPrerelease:
19-
name: Action-Test - [Prerelease]
20-
runs-on: ubuntu-latest
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
shell: [pwsh]
33+
os: [ubuntu-latest, macos-latest, windows-latest]
34+
include:
35+
- shell: powershell
36+
os: windows-latest
37+
name: Action-Test - [Prerelease] - [${{ matrix.os }}@${{ matrix.shell }}]
38+
runs-on: ${{ matrix.os }}
2139
steps:
2240
- name: Checkout repo
2341
uses: actions/checkout@v4
2442

2543
- name: Action-Test
2644
uses: ./
2745
with:
46+
Shell: ${{ matrix.shell }}
2847
Prerelease: true
2948

3049
ActionTestVersion:
31-
name: Action-Test - [Version]
32-
runs-on: ubuntu-latest
50+
strategy:
51+
fail-fast: false
52+
matrix:
53+
shell: [pwsh]
54+
os: [ubuntu-latest, macos-latest, windows-latest]
55+
include:
56+
- shell: powershell
57+
os: windows-latest
58+
name: Action-Test - [Version] - [${{ matrix.os }}@${{ matrix.shell }}]
59+
runs-on: ${{ matrix.os }}
3360
steps:
3461
- name: Checkout repo
3562
uses: actions/checkout@v4
3663

3764
- name: Action-Test
3865
uses: ./
3966
with:
67+
Shell: ${{ matrix.shell }}
4068
Version: '[0.1,0.2]'
41-
Prerelease: true

.github/workflows/Linter.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ jobs:
1616
uses: github/super-linter@latest
1717
env:
1818
GITHUB_TOKEN: ${{ github.token }}
19+
VALIDATE_JSCPD: false

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ The action can be configured using the following settings:
4343
| --- | --- | --- | --- |
4444
| Version | The version of the Utilities module to install. | '' (latest) | false |
4545
| Prerelease | Whether to install prerelease versions of the Utilities module. | false | false |
46+
| Shell | The shell to use for running the tests. | pwsh | false |
4647

4748
## Example
4849

@@ -68,3 +69,14 @@ jobs:
6869
## Permissions
6970
7071
The action does not require any permissions.
72+
73+
## Compatibility
74+
75+
The action is compatible with the following configurations:
76+
77+
| OS | Shell |
78+
| --- | --- |
79+
| windows-latest | pwsh |
80+
| windows-latest | powershell |
81+
| macos-latest | pwsh |
82+
| ubuntu-latest | pwsh |

action.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,24 @@ inputs:
1313
description: Whether to install prerelease versions of the Utilities module.
1414
required: false
1515
default: 'false'
16+
Shell:
17+
description: The shell to use for running the tests.
18+
required: false
19+
default: pwsh
1620

1721
runs:
1822
using: composite
1923
steps:
2024
- name: Run Initialize-PSModule
21-
shell: pwsh
25+
shell: ${{ inputs.Shell }}
2226
env:
2327
GITHUB_ACTION_INPUT_Version: ${{ inputs.Version }}
2428
GITHUB_ACTION_INPUT_Prerelease: ${{ inputs.Prerelease }}
2529
run: |
2630
# Initialize-PSModule
2731
Write-Host '::group::Loading modules'
32+
Install-Module -Name 'Microsoft.PowerShell.PSResourceGet' -Force -Verbose
33+
Import-Module -Name 'Microsoft.PowerShell.PSResourceGet' -Force -Verbose
2834
$params = @{
2935
Name = 'Utilities'
3036
Repository = 'PSGallery'

scripts/main.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Install-PSResource -Name 'powershell-yaml', 'PSSemVer', 'Pester', 'PSScriptAnaly
77
Stop-LogGroup
88

99
Start-LogGroup 'Loading helper scripts'
10-
Get-ChildItem -Path (Join-Path -Path $env:GITHUB_ACTION_PATH -ChildPath 'scripts' 'helpers') -Filter '*.ps1' -Recurse |
10+
Get-ChildItem -Path (Join-Path -Path $env:GITHUB_ACTION_PATH -ChildPath 'scripts\helpers') -Filter '*.ps1' -Recurse |
1111
ForEach-Object { Write-Verbose "[$($_.FullName)]"; . $_.FullName }
1212
Stop-LogGroup
1313

0 commit comments

Comments
 (0)