Site icon Exam4Training

Which of the following commands will set the $FOO environment variable within a script, so that it may be used in subsequent workflow job steps?

Which of the following commands will set the $FOO environment variable within a script, so that it may be used in subsequent workflow job steps?
A . run: echo "::set-env name=FOO::bar"
B . run: echo "FOO=bar" >> $GITHUB_ENV
C . run: echo ${{ $FOO=bar }}
D . run: export FOO=bar

Answer: B

Explanation:

The $GITHUB_ENV environment variable is used to set environment variables that persist across steps in a workflow job. By echoing FOO=bar into $GITHUB_ENV, the variable FOO will be available in subsequent steps within the same job.

Exit mobile version