Skip to content

Commit 4fb301b

Browse files
Refactor action.yml: standardize input naming, remove unused package source input, and streamline environment variable setup for PowerShell installation.
1 parent 9272ace commit 4fb301b

File tree

1 file changed

+13
-48
lines changed

1 file changed

+13
-48
lines changed

action.yml

Lines changed: 13 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,27 @@
1-
name: "Install PowerShell"
2-
description: "Install a specific version of PowerShell Core on any GitHub runner (Linux, macOS, Windows). Handles install, downgrade, or forced reinstall with uniform logging."
3-
author: "Your Org"
1+
name: Install PowerShell
2+
description: Install a specific version of PowerShell Core on any GitHub runner (Linux, macOS, Windows). Handles install, downgrade, or forced reinstall with uniform logging.
3+
author: PSModule
44
branding:
5-
icon: "terminal"
6-
color: "purple"
5+
icon: terminal
6+
color: purple
77

88
inputs:
9-
version:
10-
description: "Exact PowerShell version to install (e.g. 7.4.1)"
9+
Version:
10+
description: Exact PowerShell version to install (e.g. 7.4.1)
1111
required: true
12-
reinstall:
13-
description: "Set to 'true' to uninstall & reinstall even when the exact version is already present."
14-
default: "false"
15-
package-source:
16-
description: "Package source: 'microsoft' (default), 'github', or custom direct URL to the archive/MSI."
17-
default: "microsoft"
12+
Reinstall:
13+
description: Set to 'true' to uninstall & reinstall even when the exact version is already present.
14+
default: 'false'
1815

1916
runs:
20-
using: "composite"
17+
using: composite
2118
steps:
22-
# ---------------------------------------------------------------------
23-
# Common environment
24-
# ---------------------------------------------------------------------
2519
- name: Set shared env
2620
shell: bash
2721
run: |
28-
echo "REQUESTED_VERSION=${{ inputs.version }}" >> $GITHUB_ENV
29-
echo "REINSTALL=${{ inputs.reinstall }}" >> $GITHUB_ENV
30-
echo "PACKAGE_SOURCE=${{ inputs['package-source'] }}" >> $GITHUB_ENV
22+
echo "REQUESTED_VERSION=${{ inputs.Version }}" >> $GITHUB_ENV
23+
echo "REINSTALL=${{ inputs.Reinstall }}" >> $GITHUB_ENV
3124
32-
# ---------------------------------------------------------------------
33-
# Linux installer ------------------------------------------------------
34-
# ---------------------------------------------------------------------
3525
- name: Install PowerShell (Linux)
3626
if: runner.os == 'Linux'
3727
id: linux
@@ -71,9 +61,6 @@ runs:
7161
echo "pwsh-path=$PWSH_PATH" >> $GITHUB_OUTPUT
7262
echo "pwsh-version=$REQUESTED_VERSION" >> $GITHUB_OUTPUT
7363
74-
# ---------------------------------------------------------------------
75-
# macOS installer ------------------------------------------------------
76-
# ---------------------------------------------------------------------
7764
- name: Install PowerShell (macOS)
7865
if: runner.os == 'macOS'
7966
id: macos
@@ -113,9 +100,6 @@ runs:
113100
echo "pwsh-path=$PWSH_PATH" >> $GITHUB_OUTPUT
114101
echo "pwsh-version=$REQUESTED_VERSION" >> $GITHUB_OUTPUT
115102
116-
# ---------------------------------------------------------------------
117-
# Windows installer ----------------------------------------------------
118-
# ---------------------------------------------------------------------
119103
- name: Install PowerShell (Windows)
120104
if: runner.os == 'Windows'
121105
id: windows
@@ -152,22 +136,3 @@ runs:
152136
Invoke-WebRequest $url -OutFile $msi
153137
Start-Process msiexec.exe -ArgumentList "/i", $msi, "/quiet", "/norestart" -Wait
154138
}
155-
156-
$pwshPath = (Get-Command pwsh).Source
157-
echo "PWSH_PATH=$pwshPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
158-
echo "PWSH_VERSION=$($env:REQUESTED_VERSION)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
159-
echo "pwsh-path=$pwshPath" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
160-
echo "pwsh-version=$($env:REQUESTED_VERSION)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
161-
162-
# ---------------------------------------------------------------------
163-
# Aggregate outputs ----------------------------------------------------
164-
# ---------------------------------------------------------------------
165-
- name: Export composite outputs
166-
id: export
167-
shell: bash
168-
run: |
169-
echo "pwsh-path=$PWSH_PATH" >> $GITHUB_OUTPUT
170-
echo "pwsh-version=$PWSH_VERSION" >> $GITHUB_OUTPUT
171-
env:
172-
PWSH_PATH: ${{ env.PWSH_PATH }}
173-
PWSH_VERSION: ${{ env.PWSH_VERSION }}

0 commit comments

Comments
 (0)