nerdexam
GitHub

GITHUB-ACTIONS · Question #10

A development team has been using a Powershell script to compile and package their solution using existing tools on a Linux VM, which has been configured as a self-hosted runner. They would like to us

The correct answer is D. Use the YAML shell: pwsh in a run step.. Since the self-hosted runner is configured on a Linux VM and the script is written in PowerShell, you can invoke the script using the pwsh (PowerShell Core) shell in a run step in the workflow. This ensures that the script runs as-is on the Linux runner, as PowerShell Core (pwsh)

Configure and manage self-hosted runners

Question

A development team has been using a Powershell script to compile and package their solution using existing tools on a Linux VM, which has been configured as a self-hosted runner. They would like to use the script as-is in an automated workflow. Which of the following should they do to invoke their script within a workflow step?

Options

  • AConfigure a self-hosted runner on Windows with the requested tools.
  • BUse the YAML powershell: step.
  • CRun the pwsh2bash command to convert the script so it can be run on Linux.
  • DUse the YAML shell: pwsh in a run step.
  • EUse the actions/run-powershell action to invoke the script.

How the community answered

(43 responses)
  • A
    2% (1)
  • B
    12% (5)
  • C
    7% (3)
  • D
    77% (33)
  • E
    2% (1)

Explanation

Since the self-hosted runner is configured on a Linux VM and the script is written in PowerShell, you can invoke the script using the pwsh (PowerShell Core) shell in a run step in the workflow. This ensures that the script runs as-is on the Linux runner, as PowerShell Core (pwsh) is cross- platform and supports Linux.

Topics

#PowerShell#pwsh shell#self-hosted runners#Linux runner

Community Discussion

No community discussion yet for this question.

Full GITHUB-ACTIONS Practice