nerdexam
Microsoft

GH-200 · Question #2

As a developer, you need to add the correct syntax to allow the following workflow file to be triggered by multiple types of events. Which two code blocks should you add starting at line 5? (Each…

The correct answer is C. on. GitHub Actions supports two valid syntaxes for specifying multiple trigger events. The inline array syntax - 'on: [push, pull_request]' - is compact and fully valid. The YAML block mapping syntax uses 'on:' followed by indented event keys (e.g., push: and pull_request:) which…

Author and Maintain Workflows

Question

As a developer, you need to add the correct syntax to allow the following workflow file to be triggered by multiple types of events. Which two code blocks should you add starting at line 5? (Each correct answer presents a complete solution. Choose two.)

Exhibit

GH-200 question #2 exhibit

Options

  • Aon: [push, pull_request]
  • Bon:
  • Con:
  • Don: [push, commit]
  • Eon:
  • Fon:

How the community answered

(21 responses)
  • A
    5% (1)
  • C
    90% (19)
  • E
    5% (1)

Explanation

GitHub Actions supports two valid syntaxes for specifying multiple trigger events. The inline array syntax - 'on: [push, pull_request]' - is compact and fully valid. The YAML block mapping syntax uses 'on:' followed by indented event keys (e.g., push: and pull_request:) which allows adding filters like branches or paths per event. Option D ('on: [push, commit]') is incorrect because 'commit' is not a valid GitHub Actions event trigger. The question's answer choices C likely shows the block mapping form, which alongside option A represents the two complete, correct solutions.

Topics

#GitHub Actions#Workflow Triggers#YAML Syntax#Event Types

Community Discussion

No community discussion yet for this question.

Full GH-200 Practice