Skip to content

powershell and pwsh command discrepancy #124

Description

@rachmari

What feature or product is affected?

Actions!

What is the new or expected behavior?

Corrected shell command details (I think)!

How is the old or inaccurate behavior currently documented?

We received a report from a user

the docs state the shell commands that they run https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell

for pwsh - pwsh -command "& '{0}'"
for powershell - powershell -command "& '{0}'".

however in runs it seems that the commands are not that example

/usr/bin/pwsh -command ". '{0}'"

So the difference seems to be . vs &? If you run this workflow:

name: check shell output
on:
push:
jobs:
pwsh:
runs-on: windows-latest
steps:
- name: windows pwsh command
shell: pwsh
run: Write-Host 'Hello, World pwsh!'
powershell:
runs-on: windows-latest
steps:
- name: windows powershell command
shell: powershell
run: Write-Host 'Hello, World powershell!'

I think this is what you see in the log output for pwsh:

Run Write-Host 'Hello, World pwsh!'
Write-Host 'Hello, World pwsh!'
shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"

And for powershell:

Run Write-Host 'Hello, World powershell!'
Write-Host 'Hello, World powershell!'
shell: C:\windows\System32\WindowsPowerShell\v1.0\powershell.EXE -command ". '{0}'"

So -command ". '{0}'" in both cases but the docs shows -command "& '{0}'" in both cases?

Audience

Users who are building GitHub Actions workflows and using pwsh or powershell.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    actionsThis issue or pull request should be reviewed by the docs actions teamcontentThis issue or pull request belongs to the Docs Content team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions