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

Structure workflows using jobs, steps, job dependencies with needs, and conditional execution with if expressions.

Structure a workflow using jobs, steps, and the needs keyword to declare job dependencies and sequencing. Apply if expressions with success, failure, and custom conditions to control which jobs and steps execute.

jobs and stepsneedsif conditionaljob dependencies

Practice question for this objective

Free sampleAuthor and manage workflowsmedium

A reusable workflow invoked through workflow_call already declares an output under its on.workflow_call.outputs block that maps to a job output, so the value reaches callers. A calling workflow names the invoking job call-build and must read the returned build identifier in a separate deploy job. Which expression lets the caller's deploy job read that value?

  • Asteps.call-build.outputs.build_id, after deploy lists call-build under needs, because the reusable workflow runs as a single step whose registered outputs are read through the steps context
  • Bneeds.call-build.outputs.build_id, after deploy lists call-build under needs, because a reusable workflow's declared outputs surface on the calling job through the needs context Correct
  • Cenv.build_id, with no needs entry on deploy, because the reusable workflow writes the identifier to GITHUB_ENV so every later job in the caller reads it from the env context
  • Djobs.call-build.outputs.build_id, with no needs entry on deploy, because the calling workflow addresses other jobs and their outputs directly through the jobs context at run time
Read a reusable workflow's declared outputs in a dependent caller job using needs.<calling-job>.outputs.<name> after adding the job to needs. When a caller invokes a reusable workflow, the workflow_call outputs are surfaced on the calling job. Any dependent job that lists that job under needs reads the values through needs.<job>.outputs.<name>, which is the supported way to chain a reusable workflow's result into a later job.

Why A is wrong: A reusable workflow is invoked as a job rather than a step, so its outputs are not available through the steps context of the calling deploy job.

Why B is correct: A reusable workflow exposes its workflow_call outputs on the calling job, so a dependent job that lists that job under needs reads them as needs.<job>.outputs.<name>.

Why C is wrong: Values written to GITHUB_ENV are scoped to the job that writes them and never cross into other jobs, so the env context holds nothing for deploy here.

Why D is wrong: There is no jobs context available to expressions at run time, so the caller cannot address another job's outputs this way and the reference is invalid.

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.

  • Re-export IMAGE_TAG to the GITHUB_ENV file again as the build job's final step, because that promotes the value into the env context of every job that lists build under needs.

    Why it is wrong: Tempting because GITHUB_ENV does persist a value, but only within the same job's later steps. Re-exporting it changes nothing across jobs, so the deploy job's env context stays empty.

  • success(), because it returns true once a needed job has finished, ensuring cleanup runs after test regardless of the outcome.

    Why it is wrong: Tempting because success() relates to needed jobs, but it returns true only when every dependency succeeded, so cleanup would still be skipped after a test failure.

  • ${{ needs.build.result == 'failure' }}, because it runs the job whenever either of the two upstream jobs ends in a failed state.

    Why it is wrong: Tempting because it reads a result, but it only checks the build job, so a failure in test alone would not trigger the alert, and it misses the second dependency entirely.

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