Skip to content

Commit b08f77b

Browse files
Refactor action metadata: update descriptions for clarity and consistency; ensure proper formatting in action.yml.
1 parent 4967815 commit b08f77b

File tree

2 files changed

+55
-12
lines changed

2 files changed

+55
-12
lines changed

README.md

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,60 @@
1-
# Template-Action
1+
# Install-PowerShell
22

3-
A template repository for GitHub Actions
3+
A cross‑platform GitHub Action that installs a specific **PowerShell Core** version—or the latest stable release—on any GitHub‑hosted runner
4+
(Linux, macOS, or Windows). The action automatically skips installation when the requested version is already present.
45

56
## Usage
67

7-
### Inputs
8+
Add the action to a job in your workflow file:
89

9-
### Secrets
10-
11-
### Outputs
10+
```yaml
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
1216

13-
### Example
17+
- name: Install PowerShell
18+
uses: PSModule/install-powershell@v1
19+
with:
20+
Version: 7.5.0
1421

15-
```yaml
16-
Example here
22+
- name: Run a PowerShell script
23+
shell: pwsh
24+
run: |
25+
Write-Host "Using PowerShell $($PSVersionTable.PSVersion)"
1726
```
27+
28+
## Inputs
29+
30+
| Input | Required | Default | Description |
31+
| ------- | -------- | ------- | ----------- |
32+
| `Version` | `false` | `latest` | Desired PowerShell Core version (e.g. `7.4.1`). Use `latest` to install the newest stable release. |
33+
34+
## Secrets
35+
36+
This action does **not** require any secrets.
37+
38+
## Outputs
39+
40+
This action does **not** generate any outputs.
41+
42+
## How it works
43+
44+
* **Version resolution**
45+
If `Version` is set to `latest` (case‑insensitive), the action queries the GitHub API for the newest stable release tag in the
46+
`PowerShell/PowerShell` repository and substitutes that version.
47+
48+
* **Skip logic**
49+
Before installing, the action checks the current runner to see whether the requested version is already available
50+
(`pwsh -Command $($PSVersionTable.PSVersion)`). If it matches, the step ends immediately.
51+
52+
* **Platform‑specific installers**
53+
| Runner OS | Install strategy |
54+
| --------- | ---------------- |
55+
| **Linux** (Debian/Ubuntu‑based) | Uses APT if available; otherwise downloads the `.deb` asset directly from the release page and installs with `dpkg`. |
56+
| **macOS** | Prefers Homebrew Cask (`brew install --cask powershell`) and falls back to downloading the `.pkg` installer. ARCH detection (`arm64` / `x64`) is automatic. |
57+
| **Windows** | Downloads the corresponding `.msi` package and installs silently with `msiexec`. |
58+
59+
* **Error handling**
60+
The step fails with a clear error message if the requested version cannot be resolved or if the operating‑system distribution is unsupported (e.g., non‑APT Linux distros).

action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Install PowerShell
2-
description: >
2+
description: |
33
Install a specific version —or the latest stable version— of PowerShell Core
44
on any GitHub runner (Linux, macOS, Windows).
55
Skips the install if the requested version is already present.
@@ -10,9 +10,9 @@ branding:
1010

1111
inputs:
1212
Version:
13-
description: >
13+
description: |
1414
PowerShell version to install (e.g. `7.4.1`).
15-
Set to 'latest' to automatically install the newest stable release.
15+
Defaults to install the latest stable release.
1616
required: false
1717
default: 'latest'
1818

0 commit comments

Comments
 (0)