Skip to content

Commit 9b2d4fc

Browse files
Refactor PowerShell installation: update curl command to use jq for improved parsing of latest release version.
1 parent 6e04ef4 commit 9b2d4fc

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

action.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ runs:
3333
case "${REQUESTED_VERSION:-}" in
3434
[Ll][Aa][Tt][Ee][Ss][Tt])
3535
REQUESTED_VERSION=$(
36-
curl -sf https://api.github.com/repos/PowerShell/PowerShell/releases/latest |
37-
grep '"tag_name"' | head -n1 |
38-
sed -E 's/.*"v?([^"]+)".*/\1/'
36+
curl -s -f https://api.github.com/repos/PowerShell/PowerShell/releases/latest |
37+
jq -r '.tag_name' | sed 's/^v//'
3938
)
4039
echo "Latest stable PowerShell release detected: $REQUESTED_VERSION"
4140
;;
@@ -96,9 +95,8 @@ runs:
9695
# Only resolve to latest version if explicitly set to 'latest'
9796
if [[ "$REQ_VER_LOWER" == "latest" ]]; then
9897
REQUESTED_VERSION=$(
99-
curl -sf https://api.github.com/repos/PowerShell/PowerShell/releases/latest |
100-
grep '"tag_name"' | head -n1 |
101-
sed -E 's/.*"v?([^"]+)".*/\1/'
98+
curl -s -f https://api.github.com/repos/PowerShell/PowerShell/releases/latest |
99+
jq -r '.tag_name' | sed 's/^v//'
102100
)
103101
echo "Latest stable PowerShell release detected: $REQUESTED_VERSION"
104102
fi

0 commit comments

Comments
 (0)