nerdexam
Microsoft

GH-200 · Question #71

Which of the following is the proper syntax to specify a custom environment variable named MY_VARIABLE with the value my-value?

The correct answer is F. env:. In GitHub Actions workflow syntax, environment variables are declared using the env: keyword, followed by key-value pairs. The correct syntax is: ``yaml env: MY_VARIABLE: my-value ` The env: key is the official GitHub Actions YAML key for defining environment variables at the wor

Author and Maintain Workflows

Question

Which of the following is the proper syntax to specify a custom environment variable named MY_VARIABLE with the value my-value?

Options

  • Avar:
  • Benvironment:
  • Cvar:
  • Denv:
  • Eenvironment:
  • Fenv:

How the community answered

(17 responses)
  • A
    6% (1)
  • D
    6% (1)
  • F
    88% (15)

Explanation

In GitHub Actions workflow syntax, environment variables are declared using the env: keyword, followed by key-value pairs. The correct syntax is:

env:
  MY_VARIABLE: my-value

The env: key is the official GitHub Actions YAML key for defining environment variables at the workflow, job, or step level. Options using var: (A, C) or environment: (B, E) are not valid GitHub Actions syntax for defining environment variables. environment: is used to specify deployment environments, not variable definitions.

Topics

#GitHub Actions#Environment Variables#Workflow Syntax#YAML

Community Discussion

No community discussion yet for this question.

Full GH-200 Practice