nerdexam
Microsoft

GH-200 · Question #24

In the following workflow file, line 5 interprets lines 3 and 4 as Python. Which of the following is a valid option to complete line 5? 1 steps: 2 - run: | 3 import os 4 print(os.environ['PATH']) 5

The correct answer is A. shell: python. To execute a run: block as Python, you use shell: python on line 5. This instructs the GitHub Actions runner to pass the multi-line script block to the Python interpreter rather than the default shell (bash on Linux/macOS, PowerShell on Windows). Options B (working-directory) and

Author and Maintain Workflows

Question

In the following workflow file, line 5 interprets lines 3 and 4 as Python. Which of the following is a valid option to complete line 5? 1 steps:

2 - run: | 3 import os 4 print(os.environ['PATH']) 5

Options

  • Ashell: python
  • Bworking-directory: .github/python
  • Cshell: bash
  • Dwith: python

How the community answered

(33 responses)
  • A
    88% (29)
  • B
    6% (2)
  • C
    3% (1)
  • D
    3% (1)

Explanation

To execute a run: block as Python, you use shell: python on line 5. This instructs the GitHub Actions runner to pass the multi-line script block to the Python interpreter rather than the default shell (bash on Linux/macOS, PowerShell on Windows). Options B (working-directory) and D (with) serve entirely different purposes and do not affect interpreter selection. Option C (shell: bash) would attempt to run the Python import statement as a bash command, causing an error.

Topics

#Workflow syntax#Shell interpreter#Python workflows#Run step configuration

Community Discussion

No community discussion yet for this question.

Full GH-200 Practice