nerdexam
Microsoft

GH-200 · Question #17

You are a DevOps engineer working on a custom action. You want to conditionally run a script at the start of the action, before the main entrypoint. Which code block should be used to define the…

The correct answer is B. runs. The pre: line before the pre-if: line. Note: runs.pre-if Allows you to define conditions for the pre: action execution. The pre: action will only run if the conditions in pre-if are met. If not set, then pre-if defaults to always(). In pre-if, status check functions evaluate…

Create and manage custom actions

Question

You are a DevOps engineer working on a custom action. You want to conditionally run a script at the start of the action, before the main entrypoint. Which code block should be used to define the metadata file for your custom action?

Options

  • Aruns:
  • Bruns:
  • Cruns:
  • Druns:

How the community answered

(48 responses)
  • A
    10% (5)
  • B
    83% (40)
  • C
    2% (1)
  • D
    4% (2)

Explanation

The pre: line before the pre-if: line. Note: runs.pre-if Allows you to define conditions for the pre: action execution. The pre: action will only run if the conditions in pre-if are met. If not set, then pre-if defaults to always(). In pre-if, status check functions evaluate against the job's status, not the action's own status. Note that the step context is unavailable, as no steps have run yet. In this example, cleanup.js only runs on Linux-based runners: pre: 'cleanup.js' pre-if: runner.os == 'linux' https://docs.github.com/en/actions/reference/workflows-and-actions/metadata-syntax

Topics

#custom actions#action.yml#action lifecycle#pre-action script

Community Discussion

No community discussion yet for this question.

Full GH-200 Practice