Skip to content

GH-100 · Domain 4: Manage GitHub Actions · 24% of the exam

Task 4.1: Configure workflows and reusable components

Sharing actions and reusable workflows across an enterprise, and the Actions policies an enterprise or organization applies to them.

Study it

  • Sharing actions and reusable workflows, and Actions policies across an enterprise

    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

Repositories across an enterprise call the shared reusable workflow release.yml, which in turn calls a second reusable workflow, tag.yml, whose job pushes a Git tag and declares contents: write. Both workflows are accessible to the callers. In one repository, the calling job declares permissions with contents: read, and the tag push fails with a permission error. What fixes it?

  1. ADeclare contents: write on the job in release.yml that calls tag.yml
  2. BCall tag.yml directly from the calling job, which keeps contents: read
  3. CMove tag.yml into the same repository as release.yml and call it from there
  4. DDeclare contents: write on the calling job in that repository
Show the answer and why
  • ADeclare contents: write on the job in release.yml that calls tag.yml

    Incorrect

    Permissions can only be kept or reduced along the chain, so release.yml can't raise what it received.

  • BCall tag.yml directly from the calling job, which keeps contents: read

    Incorrect

    tag.yml would still receive only contents: read from its caller.

  • CMove tag.yml into the same repository as release.yml and call it from there

    Incorrect

    Where the called workflow lives doesn't change the permissions passed down the chain.

  • DDeclare contents: write on the calling job in that repository

    Correct

    A called workflow can't elevate the permissions it receives, so the caller has to grant them.

When reusable workflows are nested, all workflows in the chain must be accessible to the caller, and permissions can only be maintained or reduced along the chain, never elevated. A permission that a nested workflow needs must therefore be granted by the top-level calling job.

Question 2 · choose 1

In an organization, production deployments run through the reusable workflow octo-org/deploy/.github/workflows/prod.yml@v3, which many repositories call. The production self-hosted runners are in the organization's runner group prod-runners, and only the jobs of that reusable workflow may run on them. How should an owner configure prod-runners?

  1. AWorkflow access set to selected workflows, listing the caller workflow of each repository that calls prod.yml
  2. BWorkflow access left at all workflows, relying on prod.yml being the only workflow that targets the group
  3. CAccess for all repositories, and workflow access set to octo-org/deploy/.github/workflows/prod.yml@v3
  4. DAllow only prod.yml@v3 in the organization's policy for allowed actions and reusable workflows
Show the answer and why
  • AWorkflow access set to selected workflows, listing the caller workflow of each repository that calls prod.yml

    Incorrect

    Only jobs directly defined in the selected workflows get access, and the deployment jobs are defined in prod.yml.

  • BWorkflow access left at all workflows, relying on prod.yml being the only workflow that targets the group

    Incorrect

    With all workflows allowed, any job in a repository with access can target the group.

  • CAccess for all repositories, and workflow access set to octo-org/deploy/.github/workflows/prod.yml@v3

    Correct

    Only jobs directly defined in the selected reusable workflow can use the group, from whichever repository calls it.

  • DAllow only prod.yml@v3 in the organization's policy for allowed actions and reusable workflows

    Incorrect

    That policy limits which actions and reusable workflows can be used, not which jobs can use a runner group.

A runner group can be limited to selected workflows, for example to protect secrets on the runners or to standardize deployments by restricting the group to one reusable workflow. Workflows are given by full path, and reusable workflows are pinned to a branch, tag or SHA. Only jobs directly defined in the selected workflows have access to the group.

Question 3 · choose 1

An enterprise's GitHub Actions policy allows enterprise actions plus a list of selected non-enterprise actions that includes the entry actions/checkout@v6, and it requires actions to be pinned to a full-length commit SHA. A team's workflows use actions/checkout@v6, and the team doesn't want to edit its workflow files, so it onboards them to a workflow dependency lockfile that locks checkout. What happens to the checkout step?

  1. AIt runs, because the lockfile satisfies the pinning requirement and the list entry actions/checkout@v6 matches
  2. BIt stays blocked until the workflow files pin checkout to a full-length SHA as well
  3. CIt is blocked by the pinning requirement, because a lockfile doesn't count as pinning
  4. DIt passes the pinning requirement but stays blocked until the entry is actions/checkout@* or the locked SHA
Show the answer and why
  • AIt runs, because the lockfile satisfies the pinning requirement and the list entry actions/checkout@v6 matches

    Incorrect

    With a lockfile, the policy checks the locked commit SHA, which an entry pinned to a tag doesn't match.

  • BIt stays blocked until the workflow files pin checkout to a full-length SHA as well

    Incorrect

    Locked dependencies satisfy the pinning requirement without changes to the workflow file, and the tag entry still wouldn't match.

  • CIt is blocked by the pinning requirement, because a lockfile doesn't count as pinning

    Incorrect

    A lockfile satisfies the pinning requirement for the workflows onboarded to it.

  • DIt passes the pinning requirement but stays blocked until the entry is actions/checkout@* or the locked SHA

    Correct

    The locked commit meets the pinning rule, and the allowlist is checked by that commit's SHA.

For workflows onboarded to a dependency lockfile, the locked commit is what runs and what the allowed actions policy checks. Locked dependencies satisfy "Require actions to be pinned to a full-length commit SHA" without changes to the workflow files, but allowlist entries pinned to a tag or branch, such as actions/checkout@v6, don't match a locked SHA. To allow a locked dependency, the list uses a wildcard such as actions/checkout@* or the full commit SHA.

Question 4 · choose 1

The builds of a private monorepo need an Actions cache of about 40 GB that is kept for 21 days. The enterprise still uses the default cache settings: caches are kept for 7 days, with 10 GB of cache storage per repository. What has to happen?

  1. AAn enterprise owner raises the enterprise's cache limits, and the organization and repository then opt in within them
  2. BThe repository administrator sets 40 GB and 21 days on the repository, since enterprise values are only defaults
  3. CThe organization owner raises that organization's limits above the enterprise's, for this organization only
  4. DNothing can be done, because every repository is capped at 10 GB and 7 days of cache
Show the answer and why
  • AAn enterprise owner raises the enterprise's cache limits, and the organization and repository then opt in within them

    Correct

    Enterprise settings act as maximums that organization and repository limits can't exceed.

  • BThe repository administrator sets 40 GB and 21 days on the repository, since enterprise values are only defaults

    Incorrect

    Repository limits can't exceed the organization's, which can't exceed the enterprise's.

  • CThe organization owner raises that organization's limits above the enterprise's, for this organization only

    Incorrect

    Organization limits can't exceed the limits set at the enterprise level.

  • DNothing can be done, because every repository is capped at 10 GB and 7 days of cache

    Incorrect

    Enterprises can allow up to 365 days of retention for private repositories and up to 10,000 GB per repository.

By default, caches are kept for 7 days and limited to 10 GB per repository. Enterprise owners can set maximum cache retention and size for the whole enterprise; organization owners can opt in to their own limits without exceeding the enterprise's, and repository administrators without exceeding the organization's.

Question 5 · choose 1

A platform team builds a chain of reusable workflows: a caller workflow calls one reusable workflow, which calls the next, and so on, eleven workflows in all. The run fails before any job starts. What is the cause?

  1. AReusable workflows can't call other reusable workflows
  2. BEvery reusable workflow in a chain must be stored in the caller's own repository
  3. CChained workflows need a self-hosted runner group
  4. DA chain may have at most ten levels: the caller plus nine reusable workflows
Show the answer and why
  • AReusable workflows can't call other reusable workflows

    Incorrect

    A reusable workflow can call another reusable workflow.

  • BEvery reusable workflow in a chain must be stored in the caller's own repository

    Incorrect

    Workflows in the chain must be accessible to the caller, not in its repository.

  • CChained workflows need a self-hosted runner group

    Incorrect

    Nesting doesn't depend on the runner type.

  • DA chain may have at most ten levels: the caller plus nine reusable workflows

    Correct

    Eleven workflows exceed the maximum of ten levels.

You can nest reusable workflows up to ten levels: the top-level caller workflow and up to nine levels of reusable workflows. Loops in the workflow tree aren't permitted, and every workflow in the chain must be accessible to the caller.

Question 6 · choose 1

An enterprise owner has left all GitHub Actions policies unenforced. Who controls which actions and runners an organization in the enterprise can use?

  1. AOnly enterprise owners, through the Actions policies page of the enterprise settings
  2. BRepository administrators, each for their own repository only
  3. COrganization owners, and users with Manage organization Actions policies
  4. DGitHub, until an enterprise owner enforces a first policy
Show the answer and why
  • AOnly enterprise owners, through the Actions policies page of the enterprise settings

    Incorrect

    Unenforced policies leave the control to the organizations.

  • BRepository administrators, each for their own repository only

    Incorrect

    Organization-level control sits with organization owners and delegated users.

  • COrganization owners, and users with Manage organization Actions policies

    Correct

    Without enforced enterprise policies, they have full control over Actions for the organization.

  • DGitHub, until an enterprise owner enforces a first policy

    Incorrect

    GitHub doesn't restrict the organizations in place of the enterprise.

Enterprise policies control the GitHub Actions options available to organizations. If you don't enforce enterprise policies, organization owners and users with the "Manage organization Actions policies" permission have full control over GitHub Actions for their organizations.

Question 7 · choose 1

An enterprise with managed users allows members to own repositories in their user namespaces. Security wants no self-hosted runners registered on those user-owned repositories, while organizations keep their runner setup. Which Actions policy setting should an enterprise owner choose?

  1. ADisable for all organizations, under Runners
  2. BDisable standard GitHub-hosted runners for all of the enterprise's organizations
  3. CAllow enterprise actions and reusable workflows only
  4. DDisable in all Enterprise Managed User (EMU) repositories, under Runners
Show the answer and why
  • ADisable for all organizations, under Runners

    Incorrect

    That prevents repository-level runners in every organization, which goes further than needed.

  • BDisable standard GitHub-hosted runners for all of the enterprise's organizations

    Incorrect

    That setting concerns GitHub-hosted runners, not self-hosted runners on user repositories.

  • CAllow enterprise actions and reusable workflows only

    Incorrect

    That policy limits which actions run, not where runners can be registered.

  • DDisable in all Enterprise Managed User (EMU) repositories, under Runners

    Correct

    This prevents creating runners for repositories owned by managed user accounts.

In the Runners section of the enterprise's Actions policies, enterprise owners can disable repository-level self-hosted runners for all organizations, or only for repositories owned by managed user accounts. Workflows can still use enterprise and organization runners.

Practice domain 4 →Practice all domains →