Skip to content

Commit 427edf2

Browse files
committed
Remove YAML anchor and improve string quoting in PowerShell setup action
1 parent 3cc5503 commit 427edf2

1 file changed

Lines changed: 18 additions & 12 deletions

File tree

.github/actions/setup-powershell/action.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,45 +9,51 @@ runs:
99
using: composite
1010
steps:
1111
# Download the powershell '.tar.gz' archive
12-
- run: curl -L -o /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v"$POWERSHELL_VERSION"/powershell-"$POWERSHELL_VERSION"-linux-x64.tar.gz
12+
- run: curl -L -o /tmp/powershell.tar.gz "https://github.com/PowerShell/PowerShell/releases/download/v$POWERSHELL_VERSION/powershell-$POWERSHELL_VERSION-linux-x64.tar.gz"
1313
shell: bash
14-
env: &powershell_env
14+
env:
1515
POWERSHELL_VERSION: ${{ inputs.version }}
1616

1717
# Create the target folder where powershell will be placed
18-
- run: sudo mkdir -p /opt/microsoft/powershell/"$POWERSHELL_VERSION"
18+
- run: sudo mkdir -p "/opt/microsoft/powershell/$POWERSHELL_VERSION"
1919
shell: bash
20-
env: *powershell_env
20+
env:
21+
POWERSHELL_VERSION: ${{ inputs.version }}
2122

2223
# Expand powershell to the target folder
23-
- run: sudo tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/"$POWERSHELL_VERSION"
24+
- run: sudo tar zxf /tmp/powershell.tar.gz -C "/opt/microsoft/powershell/$POWERSHELL_VERSION"
2425
shell: bash
25-
env: *powershell_env
26+
env:
27+
POWERSHELL_VERSION: ${{ inputs.version }}
2628

2729
# Set execute permissions
28-
- run: sudo chmod +x /opt/microsoft/powershell/"$POWERSHELL_VERSION"/pwsh
30+
- run: sudo chmod +x "/opt/microsoft/powershell/$POWERSHELL_VERSION/pwsh"
2931
shell: bash
30-
env: *powershell_env
32+
env:
33+
POWERSHELL_VERSION: ${{ inputs.version }}
3134

3235
# Unlink the original pwsh binary already present in the system
3336
- run: sudo unlink /usr/bin/pwsh
3437
shell: bash
3538

3639
# Create the symbolic link that points to pwsh
37-
- run: sudo ln -s /opt/microsoft/powershell/"$POWERSHELL_VERSION"/pwsh /usr/bin/pwsh
40+
- run: sudo ln -s "/opt/microsoft/powershell/$POWERSHELL_VERSION/pwsh" /usr/bin/pwsh
3841
shell: bash
39-
env: *powershell_env
42+
env:
43+
POWERSHELL_VERSION: ${{ inputs.version }}
4044

4145
# Verify the installation by checking the `pwsh` command version.
4246
- run: |
4347
pwsh --version
4448
[[ "$(pwsh --version)" == "PowerShell $POWERSHELL_VERSION" ]]
4549
shell: bash
46-
env: *powershell_env
50+
env:
51+
POWERSHELL_VERSION: ${{ inputs.version }}
4752
4853
# Verify the installation by using the `pwsh` shell.
4954
- run: |
5055
$PSVersionTable
5156
if ( $PSVersionTable.PSVersion.ToString() -ne "$env:POWERSHELL_VERSION" ) { exit 1 }
5257
shell: pwsh
53-
env: *powershell_env
58+
env:
59+
POWERSHELL_VERSION: ${{ inputs.version }}

0 commit comments

Comments
 (0)