Hard GH-200 practice questions
Challenge — multi-step scenarios, trade-offs, and subtle distinctions. 13 hard questions available — no sign-up, always free.
Your CI workflow builds and caches Node dependencies using a key derived from package-lock.json. The workflow triggers on both pull_request from forks and push to main. A security reviewer warns that a malicious contributor could poison the shared cache. What is the MOST accurate description of GitHub Actions cache scoping that mitigates this concern, and what remaining precaution is still required?
You maintain a Docker container action that builds from a `Dockerfile` in the repository root. It works on your local machine and on self-hosted ARM64 runners, but every run on the standard GitHub-hosted `ubuntu-latest` runner fails immediately during the container build step with an 'exec format error' when the entrypoint script is invoked. The action.yml declares `runs.using: docker` and `runs.image: Dockerfile`. What is the most likely cause and appropriate fix?
Your enterprise has a self-hosted runner group named 'gpu-builders' created at the enterprise level, currently granted to two organizations. A third organization, 'ml-research', is onboarded and needs to run jobs on these runners. After the enterprise owner adds 'ml-research' to the runner group's organization access list, the org admin reports that no repositories in 'ml-research' can queue jobs to 'gpu-builders'. What additional step is required?
As a GitHub Enterprise admin, you need to monitor how frequently a specific self-hosted runner group is being used across all organizations and identify which repositories consume the most minutes on those runners. You want a programmatic, near-real-time signal that a job has been queued for or assigned to a runner in that group, so you can feed the data into a custom dashboard. Which approach best meets this requirement?
Your team maintains a popular JavaScript action distributed via the GitHub Marketplace. After GitHub's immutable-actions feature is enabled for your repository and you publish a new release, a downstream consumer reports that their workflow now resolves your action from the GitHub Container Registry (ghcr.io) rather than fetching the Git ref from the repository. The consumer asks what practical change immutable actions introduce for how they should reference your action. Which statement best describes the correct implication for the consumer?
A developer defines the following matrix strategy in a workflow job named `test`: ```yaml jobs: test: strategy: matrix: os: [ubuntu-latest, windows-latest] node: [16, 18, 20] include: - os: ubuntu-latest node: 20 experimental: true runs-on: ${{ matrix.os }} ``` In the Actions UI checks list, one variant appears as `test (ubuntu-latest, 20, true)` and shows a red X, while `test (ubuntu-latest, 20)` is not listed separately. What does this tell you about the failed variant?
A workflow calls an internal API using a token stored in the repository secret API_TOKEN. A developer wants to derive a shortened 'client key' from the token at runtime (the first 12 characters) and print it to the log for debugging, while ensuring GitHub still masks the full secret. Which approach correctly prevents the full secret from leaking in logs?
Your team builds a container image in a GitHub Actions workflow and generates a build provenance attestation using the actions/attest-build-provenance action. A separate deployment workflow, running on a self-hosted runner in your production cluster, must refuse to deploy any image whose provenance cannot be confirmed as built by your organization's repository. Which approach correctly enforces this in the deployment workflow?
Your team maintains a public repository that receives many pull requests from forks. You need a workflow that automatically labels incoming PRs based on which files changed, and the labeling step requires write access to the repository's issues/PRs. A security review flags that using the standard 'pull_request' event does not grant sufficient token permissions for PRs originating from forks. Which trigger and configuration correctly allows the labeling job to run with write access while handling fork PRs?
A public repository runs a CI workflow triggered on pull_request. The security team is concerned that contributors submitting pull requests from forks could exfiltrate repository secrets or run malicious code with elevated permissions. The team wants forked PRs to still get automated build/test feedback, but any workflow run that needs secrets or write access must not execute automatically for first-time or untrusted contributors. Which configuration best addresses this concern with the least additional custom scripting?
A platform team maintains a reusable workflow (build.yml) invoked via workflow_call. The reusable workflow builds an artifact and computes a version string that the calling workflow needs to use in a later deployment job. Inside build.yml, a step named 'compute' writes 'ver=1.4.2' to $GITHUB_OUTPUT in job 'package'. Which combination correctly exposes this value so the caller's downstream job can reference it?
Your enterprise runs a fleet of self-hosted Linux runners for a large monorepo. Builds frequently call actions/setup-node and actions/setup-python, but you notice these steps download and compile the requested versions on every run, adding several minutes per job. On GitHub-hosted runners these same steps complete almost instantly. What is the most effective way to make the setup-* actions resolve versions instantly on your self-hosted runners?
Your team maintains a 'CI' workflow that runs on every push. You want a separate 'Deploy' workflow to run automatically only after the 'CI' workflow finishes successfully on the main branch, and you must inspect whether that upstream run passed before deploying. Which trigger and condition configuration achieves this?