GH-200 · Domain 2: Consume and troubleshoot workflows · 19% of the exam
Task 2.3: Use and manage workflow templates
Public and organization workflow templates, consuming reusable workflows, when a template, a reusable workflow or a composite action fits, and disabling versus deleting a workflow.
Study it
Workflow templates, reusable workflows and composite actions, and disabling workflows
Lesson coming
Sample questions
Try each one before opening the answer. Every option is explained, with the GitHub documentation page that proves it.
Question 1 · choose 1
An organization keeps its workflow templates in a private .github repository. Developers creating workflows in the organization's private repositories see the templates, but in its public open source repositories the templates don't appear. The templates contain no sensitive content. What should the organization change?
AChange the .github repository to public
BChange the .github repository to internal
CCopy the templates into each public repository's workflow-templates folder
DAdd the public repositories' languages to each template's categories
Show the answer and why
AChange the .github repository to public
Correct
Templates in a public .github repository are available to all repository types.
BChange the .github repository to internal
Incorrect
Templates in an internal .github repository reach only internal and private repositories.
CCopy the templates into each public repository's workflow-templates folder
Incorrect
Repositories don't offer templates from their own folders.
DAdd the public repositories' languages to each template's categories
Incorrect
Categories decide which groups a template is shown under, such as a language; they don't change which repository types it is offered to.
A repository can use templates from a .github repository whose visibility matches or is broader than its own. Templates in a public .github repository are available to all repository types, in an internal one to internal and private repositories, and in a private one only to private repositories.
A team is choosing between a reusable workflow and a composite action for shared build logic. Which two statements are true? (Choose TWO.)
AA composite action's steps each appear as separate steps in the caller's log
BA reusable workflow can be stored in any folder of its repository
CA composite action can be published to GitHub Marketplace, and a reusable workflow can't
DA reusable workflow's jobs can run on a different runner than the caller's jobs
EA composite action can define several jobs that run in parallel
Show the answer and why
AA composite action's steps each appear as separate steps in the caller's log
Incorrect
A composite action is logged as one step, even if it has many.
BA reusable workflow can be stored in any folder of its repository
Incorrect
Each reusable workflow is a file in the repository's .github/workflows directory.
CA composite action can be published to GitHub Marketplace, and a reusable workflow can't
Correct
Composite actions can be listed on Marketplace; reusable workflows can't.
DA reusable workflow's jobs can run on a different runner than the caller's jobs
Correct
Each job of a reusable workflow chooses its own runner.
EA composite action can define several jobs that run in parallel
Incorrect
Composite actions contain steps only; jobs belong to workflows.
Reusable workflows are files in .github/workflows that contain jobs, each with its own runner, and they log every job and step separately. Composite actions contain no jobs, are logged as one step and can be published to GitHub Marketplace; reusable workflows can't.
Teams want a one-click way to add CI to new repositories from the Actions tab. The platform team also wants to change the build logic later in one place, without teams re-adding anything. What should the platform team publish?
AA workflow template containing the full build logic
BA workflow template whose job calls a reusable workflow kept in a central repository
CA reusable workflow alone, announced to teams by email
DA required workflow that rulesets add to every repository
Show the answer and why
AA workflow template containing the full build logic
Incorrect
One click works, but the build logic would then sit in each repository's own workflow file rather than in one place.
BA workflow template whose job calls a reusable workflow kept in a central repository
Correct
The template adds the workflow in one click, and the logic it calls stays maintained in one place.
CA reusable workflow alone, announced to teams by email
Incorrect
The logic stays central, but nothing appears in the Actions tab for one-click setup.
DA required workflow that rulesets add to every repository
Incorrect
A ruleset can require a workflow to pass before merging; it doesn't give teams a one-click template.
Workflow templates let people create a workflow from the Actions tab quickly, and a template can reference a reusable workflow so that the centrally managed code stays in one place. Referencing it by SHA pins the exact version; a tag or branch lets updates flow to callers.
A developer wants to add a GitHub-provided Python CI workflow to a repository that already has workflows. Where does she start?
ASettings, then Actions, then General
BActions, then New workflow, then Configure on the template
CInsights, then Dependency graph
DCode, then Add file, then Upload files
Show the answer and why
ASettings, then Actions, then General
Incorrect
Those settings control Actions policies, not new workflows.
BActions, then New workflow, then Configure on the template
Correct
The Choose a workflow page lists templates to configure and commit.
CInsights, then Dependency graph
Incorrect
That shows dependencies, not workflow templates.
DCode, then Add file, then Upload files
Incorrect
Uploading files doesn't offer templates.
In the Actions tab, New workflow opens the Choose a workflow page with recommended templates. Configure opens the template for editing before it is committed.
An organization wants its own workflow templates to appear for its members. Where are they stored?
AIn .github/workflows of every repository
BIn the organization's settings under Actions
CIn a repository named workflow-templates
DIn the workflow-templates directory of the organization's .github repository
Show the answer and why
AIn .github/workflows of every repository
Incorrect
That folder holds a repository's own workflows.
BIn the organization's settings under Actions
Incorrect
Templates are files, not settings.
CIn a repository named workflow-templates
Incorrect
workflow-templates is a directory inside the .github repository.
DIn the workflow-templates directory of the organization's .github repository
Correct
Template files and their metadata go in that directory.
To create workflow templates for an organization, create a repository named .github if it doesn't exist, add a workflow-templates directory, and put each template and its metadata file there.
Ten repositories created workflows from an organization template last year. The template was improved yesterday. What happens to the ten workflows?
AThey update on their next run
BThey are disabled until reviewed
CThey show a banner offering to merge the changes automatically
DThey don't change until each repository edits its own file
Show the answer and why
AThey update on their next run
Incorrect
A copy made from a template isn't linked back to it.
BThey are disabled until reviewed
Incorrect
Changing a template doesn't affect existing workflows.
CThey show a banner offering to merge the changes automatically
Incorrect
GitHub doesn't track copies made from templates.
DThey don't change until each repository edits its own file
Correct
A workflow created from a template is an independent copy.
A workflow template is a scaffold that is copied when someone creates a workflow, after which the workflow is independent and later changes to the template don't reach it.
A maintainer wants to turn off a scheduled workflow from the terminal for a few weeks and later turn it back on with a single command. Which command fits?
Agh run cancel with the ID of the workflow's latest run
Bgh workflow disable with the workflow's name
Cgh run delete with the ID of the workflow's latest run
Dgit rm on the workflow file
Show the answer and why
Agh run cancel with the ID of the workflow's latest run
Incorrect
That cancels one run; the schedule stays active.
Bgh workflow disable with the workflow's name
Correct
It turns the workflow off, and gh workflow enable turns it back on.
Cgh run delete with the ID of the workflow's latest run
Incorrect
That deletes a run, not the workflow's triggers.
Dgit rm on the workflow file
Incorrect
Bringing a removed file back takes a new commit, not one gh command.
A workflow can be disabled and enabled from the Actions tab, the REST API or GitHub CLI with gh workflow disable and gh workflow enable.