GH-200 - Author and manage workflows - Section 1.2

Define and validate workflow_dispatch inputs and pass inputs and secrets to reusable workflows through workflow_call.

Define typed workflow_dispatch inputs and validate their values at trigger time. Pass inputs and secrets to reusable workflows via workflow_call, distinguishing required from optional inputs.

workflow_dispatch inputsworkflow_callinputs and secretsreusable workflow inputs

Practice question for this objective

Free sampleAuthor and manage workflowsmedium

A reusable workflow declares its accepted inputs and secrets under workflow_call, and a caller invokes it with the uses key. The caller must pass a required string input named image_tag and a secret named REGISTRY_TOKEN. Which combination of keys does the caller use to supply these values to the reusable workflow?

jobs:
  deploy:
    uses: octo-org/repo/.github/workflows/deploy.yml@v2
    <keys>
  • APass both image_tag and REGISTRY_TOKEN under a single with map, because inputs and secrets are both delivered to a reusable workflow through the with key.
  • BPass image_tag under an inputs map and REGISTRY_TOKEN under an env map, because the caller mirrors the input and environment blocks of the reusable workflow.
  • CPass image_tag under a with map and REGISTRY_TOKEN under a secrets map at the calling job, matching the input and secret names declared under workflow_call. Correct
  • DPass image_tag under a with map and REGISTRY_TOKEN under a needs map, because needs forwards the calling workflow's secrets into the reusable workflow.
Pass declared inputs to a reusable workflow through with and declared secrets through the secrets map on the calling job. When a job calls a reusable workflow with the uses key, declared inputs are supplied through the with map and declared secrets through the secrets map, with each key matching the names defined under the reusable workflow's workflow_call block. Secrets are deliberately kept out of with so they are handled through their own typed channel, and env or needs do not transport caller-supplied input or secret values.

Why A is wrong: Tempting because with does carry inputs, but secrets are not passed through with. A reusable workflow receives secrets through a separate secrets map, and routing a secret through with would not satisfy its secrets declaration.

Why B is wrong: Tempting because the reusable workflow defines an inputs block, but the caller supplies values through with, not a map literally named inputs, and a secret is passed through secrets rather than through env.

Why C is correct: A caller supplies declared inputs through the with map and declared secrets through the secrets map on the calling job, so each key name matches the workflow_call definitions and the values reach the reusable workflow.

Why D is wrong: Tempting because both keys appear on jobs, but needs only declares job dependencies and ordering. It does not forward secrets, so the secret would never reach the reusable workflow.

See more GH-200 practice questions, answers explained.

More in this domain

Back to all Author and manage workflows objectives, or the GH-200 cert hub.

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