Skip to content

Commit 2a9d893

Browse files
🩹 [Patch]: Add inputs to override version of Utilities (#14)
## Description - Add inputs to override version of `Utilities`: - `Version` to set a version to use. - `Prerelease` to allow prerelease versions. ## 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 abd26d9 commit 2a9d893

File tree

3 files changed

+53
-6
lines changed

3 files changed

+53
-6
lines changed

.github/workflows/Action-Test.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,28 @@ jobs:
1414

1515
- name: Action-Test
1616
uses: ./
17+
18+
ActionTestPrerelease:
19+
name: Action-Test - [Prerelease]
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout repo
23+
uses: actions/checkout@v4
24+
25+
- name: Action-Test
26+
uses: ./
27+
with:
28+
Prerelease: true
29+
30+
ActionTestVersion:
31+
name: Action-Test - [Version]
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout repo
35+
uses: actions/checkout@v4
36+
37+
- name: Action-Test
38+
uses: ./
39+
with:
40+
Version: '[0.1,0.2]'
41+
Prerelease: true

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,8 @@ The action can be configured using the following settings:
4141

4242
| Name | Description | Default | Required |
4343
| --- | --- | --- | --- |
44-
| | | | |
45-
46-
### Configuration file
47-
48-
There are no configuration settings for the Initialize-PSModule action.
44+
| Version | The version of the Utilities module to install. | '' (latest) | false |
45+
| Prerelease | Whether to install prerelease versions of the Utilities module. | false | false |
4946

5047
## Example
5148

action.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,39 @@ branding:
55
icon: loader
66
color: gray-dark
77

8+
inputs:
9+
Version:
10+
description: The version of the Utilities module to install.
11+
required: false
12+
Prerelease:
13+
description: Whether to install prerelease versions of the Utilities module.
14+
required: false
15+
default: 'false'
16+
817
runs:
918
using: composite
1019
steps:
1120
- name: Run Initialize-PSModule
1221
shell: pwsh
22+
env:
23+
GITHUB_ACTION_INPUT_Version: ${{ inputs.Version }}
24+
GITHUB_ACTION_INPUT_Prerelease: ${{ inputs.Prerelease }}
1325
run: |
1426
# Initialize-PSModule
1527
Write-Host '::group::Loading modules'
16-
Install-PSResource -Name 'Utilities' -TrustRepository -Verbose
28+
$params = @{
29+
Name = 'Utilities'
30+
Repository = 'PSGallery'
31+
TrustRepository = $true
32+
PreRelease = $env:GITHUB_ACTION_INPUT_Prerelease -eq 'true'
33+
Verbose = $true
34+
}
35+
36+
if (-not [string]::IsNullOrEmpty($env:GITHUB_ACTION_INPUT_Version)) {
37+
$params['Version'] = $env:GITHUB_ACTION_INPUT_Version
38+
}
39+
40+
Install-PSResource @params
41+
Write-Host '::endgroup::'
1742
1843
. "$env:GITHUB_ACTION_PATH\scripts\main.ps1" -Verbose

0 commit comments

Comments
 (0)