GH-200 - Author and manage workflows (25% of the exam) - Section 1.5

Generate job variations with strategy and matrix, applying include and exclude, fail-fast and max-parallel to control build coverage and cost.

Generate parallel job variations with strategy and matrix, and use include to add combinations and exclude to remove them. Tune fail-fast and max-parallel to balance coverage against runner cost and build time.

strategy matrixinclude and excludefail-fastmax-parallel

Practice question for this objective

Free sampleAuthor and manage workflowshard

A matrix defines os with two values and node with two values, expanding into four jobs. The team needs one additional job that uses an os value already in the matrix paired with a node value that is not listed, without enlarging the other combinations. Which matrix key produces exactly that one extra job?

strategy:
  matrix:
    os: [ubuntu-latest, windows-latest]
    node: [18, 20]
    <key>:
      - os: ubuntu-latest
        node: 22
  • Ainclude, because a pair whose node value is absent from the base matrix is added as a brand new combination instead of extending an existing one. Correct
  • Bexclude, because listing the os and node pair under exclude appends it to the generated set as a distinct extra combination to build.
  • Cmax-parallel, because capping concurrency lets the runner schedule one supplementary node version alongside the four matrix jobs already defined.
  • Dfail-fast, because disabling it instructs the matrix to expand a recovery combination for any node version that is otherwise missing.
Use matrix include to add a new combination when its values do not match any existing expanded entry. When an include entry shares a key value such as os but introduces a value not present in the base axis, GitHub Actions cannot fold it into an existing combination, so it appends a separate job. Here ubuntu-latest with node 22 is added as a fifth job while the four base combinations remain untouched. exclude removes jobs, and max-parallel and fail-fast never alter the set of combinations.

Why A is correct: include adds a fresh combination when the pair does not match any expanded entry, so node 22 with ubuntu-latest becomes one extra job while the original four are left unchanged.

Why B is wrong: Tempting because exclude also takes os and node pairs, but exclude removes matching combinations from the expansion rather than adding new ones, so it cannot create the extra job.

Why C is wrong: Tempting because max-parallel governs the matrix, but it only limits how many jobs run at once. It does not define combinations, so it cannot introduce an additional node 22 job.

Why D is wrong: Tempting because fail-fast also sits under strategy, but it only controls cancellation of siblings on failure. It never adds combinations, so no node 22 job would appear.

See more GH-200 practice questions, answers explained.

Exam traps in Author and manage workflows

Answers that look right on this material and are not. Each one is a distractor from a different question in the GH-200 bank for this domain.

  • Set max-parallel to five so the scheduler drops the sixth windows-latest with arm64 combination once the parallel cap for the matrix is reached.

    Why it is wrong: Tempting because five matches the desired job count, but max-parallel only throttles concurrency. All six combinations still run, just fewer at a time, so the unsupported one is not removed.

  • Set strategy.fail-fast to false on the test job so the dynamically generated matrix combinations are permitted to expand from the upstream output instead of being cancelled before they start.

    Why it is wrong: Tempting because it sits under strategy, but fail-fast only governs whether siblings cancel on a failure and plays no part in parsing an output string into matrix combinations.

  • The matrix.image value is exposed only after the job completes, so runs-on must hardcode one image and the matrix value can be read only in a later dependent job through the needs context.

    Why it is wrong: Tempting because cross-job values use needs, but the matrix context is resolved as each combination is scheduled, so runs-on can use it directly rather than waiting for completion.

Examworthy is not affiliated with or endorsed by GitHub. Original, blueprint-aligned practice material only.