Domain 1: Workflow Fundamentals & Syntax
GitHub Actions · 115 questions
- Which YAML key do you use at the top level of a workflow file to specify what events trigger the workflow?
- Which of the following is REQUIRED inside every job definition in a GitHub Actions workflow?
- When using the workflowdispatch trigger, which input type allows the user to choose from a predefined list of values?
- Which cron expression in a GitHub Actions schedule trigger runs a workflow every day at midnight UTC?
- Which expression accesses the name of the event that triggered the current workflow run?
- What is the difference between 'uses:' and 'run:' in a workflow step?
- In a GitHub Actions workflow with jobs 'build', 'test', and 'deploy', how do you ensure 'deploy' only runs after both 'build' and 'test' succeed?
- Which expression correctly skips a step unless the workflow was triggered by a push to the 'main' branch?
- You define 'NODEENV: production' under the workflow-level 'env:' block. How do you reference this value in an expression inside a step's 'if:' condition?
- What is the default shell used by 'run:' steps on a GitHub-hosted Windows runner?
- Which trigger must a reusable workflow define to be callable from another workflow?
- In a matrix strategy with os: [ubuntu, windows] and node: [16, 18], which key removes the ubuntu+node16 combination specifically?
- By default, if one job in a matrix strategy fails, what happens to the remaining matrix jobs?
- Which configuration cancels any in-progress workflow run for the same branch when a new push triggers a new run?
- How do you pass a value from one job to a dependent job in GitHub Actions?
- What is the current supported method to set a step output in GitHub Actions?
- Why is 'pullrequesttarget' considered higher risk than 'pullrequest' when used with secrets?
- The 'workflowrun' trigger fires when another workflow completes. Which filter lets you run only when the triggering workflow succeeded?
- How do you configure a push trigger to only run when files in the 'src/' directory change?
- Which YAML syntax allows a 'run:' step to span multiple shell commands across multiple lines?
- Which of the following correctly uses a GitHub Actions expression to set an environment variable in a step?
- Which status check function ensures a step runs even if a previous step failed?
- What is the default timeout for a GitHub Actions job if 'timeout-minutes' is not specified?
- A step has 'continue-on-error: true'. If the step fails, what is the job's conclusion?
- Where must workflow YAML files be located within a GitHub repository to be recognized by GitHub Actions?
- Which GitHub Actions expression function converts an object to a JSON string for debugging output?
- What does the 'hashFiles()' function return when used as a cache key?
- Job 'build' produces an output named 'image-tag'. Job 'deploy' depends on 'build'. Which expression accesses the image-tag value in 'deploy'?
- At what levels can you set the 'permissions:' block in a GitHub Actions workflow?
- Which GitHub Actions trigger allows external systems to trigger workflows via the GitHub REST API?
- Which operator is used in GitHub Actions expressions to check if a string contains a substring?
- A step has 'id: get-version' and outputs to $GITHUBOUTPUT. How do you reference its 'version' output in a later step?
- How can you create a dynamic matrix where the list of values is determined by a previous job?
- Which workflow command creates an annotation that appears in the GitHub Actions log and PR review?
- How do you set an environment variable that persists for all subsequent steps in the same job?
- What is the purpose of the $GITHUBPATH environment file?
- In a matrix strategy, what does the 'include:' key do when it matches an existing combination?
- What is the maximum number of jobs allowed in a single GitHub Actions workflow run?
- How do you trigger a workflow only when a semantic version tag (e.g., v1.2.3) is pushed?
- A workflow job has been running for 45 minutes but appears stuck in a loop. What is the fastest way to stop it from the GitHub UI?
- Which context is NOT available during the 'if:' condition evaluation at the job level?
- For a pullrequest event, what does 'github.sha' contain?
- Which 'env:' scope takes precedence when the same variable name is defined at workflow, job, and step levels?
- What does 'github.actor' contain in a workflow run triggered by a GitHub App?
- Before pushing a workflow file, which tool can you use locally to validate the YAML syntax?
- In a matrix strategy, how is the job name displayed in the GitHub Actions UI by default?
- What does the GITHUBEVENTPATH environment variable contain?
- Who can manually trigger a workflowdispatch event on a private repository?
- Which commit message string, when included in the HEAD commit message, prevents GitHub Actions from triggering push and pullrequest workflows?
- The 'workflowrun' trigger has a 'branches:' filter. What does it filter?
- In a reusable workflow's on.workflowcall.inputs block, what happens if a caller doesn't provide a 'required: true' input?
- You want to trigger a workflow only when a specific label 'deploy' is added to a pull request. Which configuration is correct?
- Can workflow-level 'env:' values reference other context variables like 'github.ref'?
- How do you set the working directory for a specific 'run:' step to a subdirectory?
- The 'issues' event has activity types like 'opened', 'edited', 'closed', 'labeled'. If no 'types:' filter is specified, which activity types trigger the workflow?
- Which expression pattern provides a fallback value when an input might be empty?
- What is the maximum size of a single step output set via $GITHUBOUTPUT?
- You want to prevent concurrent deployments to production but not cancel in-progress deployments when a new one queues. Which concurrency configuration achieves this?
- In a reusable workflow called via workflowcall, how do you access the inputs passed by the caller?
- Which expression determines if a workflow is running in a private repository?
- What is the minimum interval for schedule triggers in GitHub Actions?
- Which expression correctly checks whether the current branch name contains the substring 'release'?
- Job 'deploy' lists 'needs: [build, test]'. Which expression correctly runs 'deploy' only when both 'build' and 'test' concluded successfully?
- A job named 'prepare' writes a JSON array of OS names to an output called 'os-list'. Which strategy block correctly builds a matrix from that output?
- You want every 'run:' step in a single job to execute with working directory './services/api' without setting 'working-directory' on each step. Where do you configure this?
- Which pair of github context properties correctly identifies both the event type that started the run and the full git ref for the commit?
- You need a cleanup job that runs when the workflow is cancelled mid-flight, but not on a normal successful completion. Which job-level condition is appropriate?
- A production deploy job must share a concurrency group named 'prod-deploy' so only one production deployment runs at a time, and queued deploys should wait rather than cancel the active one. Which job configuration is correct?
- Which two expression functions return a boolean used to test string prefixes or suffixes? (Choose two)
- You add a workflowdispatch input named 'forcedeploy' that should appear as a checkbox in the 'Run workflow' UI. Which input type must you use?
- A step has 'id: unit' and 'continue-on-error: true'. The step fails. What is the difference between 'steps.unit.outcome' and 'steps.unit.conclusion'?
- A job sets 'env: TARGET: staging'. Which syntax correctly references TARGET inside a step 'if:' condition?
- A matrix defines os: [ubuntu-latest, windows-latest] and node: [18, 20]. You need to add one extra combination of os: macos-latest with node: 20 without expanding macos across all node versions. Which key adds only that combination?
- Which expression uses the format function to produce the string 'build-42' when github.runnumber is 42?
- A workflow file must be invokable both manually from the Actions UI and as a reusable workflow from other repositories' workflows. Which 'on:' configuration supports both entry points?
- You want a cache key that changes when either package-lock.json or .npmrc changes. Which hashFiles call is valid?
- Why can you NOT use the 'jobs' context inside a job-level 'if:' condition to inspect another job that already finished?
- According to GitHub Actions syntax rules, which form is valid for a step-level if condition?
- By default, matrix jobs use fail-fast behavior. What does setting 'strategy.fail-fast: false' change?
- Jobs 'lint' and 'test' both list 'needs: [build]'. Job 'deploy' must run only after both 'lint' and 'test' succeed. Which 'needs' declaration is correct on 'deploy'?
- Job 'notify' has 'needs: [deploy]' and should run even when 'deploy' fails, but only when the failure was a real failure (not a skip). Which job-level 'if' condition is most appropriate?
- A step has 'id: smoke' and 'continue-on-error: true'. The step's command exits with code 1. A later step uses 'if: steps.smoke.outcome == 'failure''. What happens?
- A job sets 'timeout-minutes: 30'. One long-running step sets 'timeout-minutes: 10'. After 10 minutes the step is still running. What occurs?
- A workflow sets 'defaults.run.shell: bash' and 'defaults.run.working-directory: ./app' at the workflow level. A step overrides only 'working-directory: ./tools'. Which shell does that step use, and where does it run?
- Job 'package' has a step 'id: meta' that writes 'version=1.4.2' to $GITHUBOUTPUT. Job 'publish' has 'needs: [package]'. What must 'package' declare so 'publish' can read the version via needs?
- strategy.matrix defines os: [ubuntu-latest, windows-latest] and node: [18, 20]. You need to drop only windows-latest + node 18, and add one extra job ubuntu-latest + node 22. Which keys accomplish this?
- You need a 'cleanup' job that runs after 'build' whether build succeeds, fails, or is cancelled. Which condition is required?
- A step should run only when the workflow is triggered from a branch whose ref name contains 'hotfix/'. Which expression is correct?
- Production deploys must never run two at once for the same environment, but an in-progress deploy must finish even if a newer run is queued. Which concurrency block is correct?
- You want a nightly build at 02:15 UTC and also on pushes that touch 'services/' only. Which 'on:' configuration matches?
- A single workflow file must be callable as a reusable workflow and manually triggerable with an environment input. What belongs under 'on:'?
- Why might a job-level 'if: ${{ secrets.DEPLOYKEY != '' }}' fail to behave as authors expect?
- A step must export a multi-line PEM certificate as a step output named 'cert'. Which approach follows current GitHub Actions guidance?
- A matrix has 12 combinations. You want at most 3 matrix jobs running at once, and remaining jobs should continue even if one combination fails. Which strategy settings are required?
- Which two statements about job 'needs' graphs are true? (Choose two.)
- Job 'page-oncall' should run only when the workflow was cancelled (for example, a user cancelled a long deploy). Which if condition targets that case?
- Job 'discover' outputs a JSON array of package names as 'packages'. Job 'build' should matrix over that list. Which pattern is correct?
- An organization wants developers to start new repositories with a ready-made CI workflow. Where must organization workflow templates live so the GitHub UI offers them when creating a new workflow?
- What is the primary effect of enabling an organization required workflow that targets selected repositories?
- In a monorepo, you want the frontend CI workflow to run only when files under apps/web/ change on push. Which trigger configuration is correct?
- A pull request workflow should cancel older runs for the same PR when new commits are pushed. Which concurrency configuration is most appropriate?
- Which set of workflow commands creates annotations at notice, warning, and error severity levels in GitHub Actions logs?
- Two steps in the same job both append Markdown tables to the job summary. What is the correct way to ensure both tables appear on the run summary page?
- What is the purpose of adding a problem matcher (for example via ::add-matcher::) in a GitHub Actions job?
- A JavaScript action’s main step must pass a temporary directory path to its post cleanup script. After set-output/save-state deprecation, which mechanism should main use?
- A step must place a multi-line TLS certificate into an environment variable for later steps in the same job via $GITHUBENV. Which pattern is correct?
- You want every run: step in a job to execute with working-directory: backend unless a step overrides it. Where should you set this most efficiently?
- Job build sets a step output version via $GITHUBOUTPUT. Job release needs that value. Which configuration correctly exposes and consumes it?
- Job deploy should run only when job test succeeds, but job notify should run if test fails or succeeds (not when cancelled). Which pair of if: expressions is appropriate?
- A reusable workflow defines on.workflowcall.inputs.releasetype as a string choice among patch, minor, and major for callers. How should callers pass the value?
- You have strategy.matrix.os: [ubuntu-latest, windows-latest]. You need one additional job that runs ubuntu-latest with an extra experimental: true flag without rewriting the whole matrix by hand. Which key adds that combination?
- The workflow sets permissions: contents: read at the top level, but one job must push a release tag. What is the least-privilege fix?
- A flaky integration step occasionally hangs. You want that step to fail after 15 minutes without changing the job’s overall 60-minute default budget unless the hang occurs. Which key should you set on the step?
- Which two expressions correctly evaluate string checks commonly used in job if: conditions? (Choose two.)
- A matrix builds six OS/runtime combinations. You want every combination to finish even if one fails, so you collect full results. Which strategy setting is required?