📝 Workflow Syntax & Structure - GH-ACTIONS Practice Questions

Learn GitHub Actions workflow YAML syntax: triggers, jobs, steps, actions, expressions, and contexts.

23Questions Available
1Exam Domains

Practice Workflow Syntax Questions Now

Start a timed practice session focusing on Workflow Syntax & Structure topics from the GH-ACTIONS question bank.

Start GH-ACTIONS Practice Quiz →

GH-ACTIONS Workflow Syntax Question Bank (23 Questions)

Browse all 23 practice questions covering Workflow Syntax & Structure for the GH-ACTIONS certification exam. Each question includes the full answer and a detailed explanation to help you understand the concepts.

  1. Question 1Author and Manage Workflows

    What GitHub Actions context variable contains the name of the branch that triggered a push workflow?

    A${{ env.BRANCH }}
    B${{ github.ref }}
    C${{ runner.branch }}
    D${{ steps.branch.outputs.name }}
    Show Answer & Explanation
    Correct Answer: B
    Explanation:

    ${{ github.ref }} contains the full ref, e.g., refs/heads/main. For branch name only, use github.ref_name.

  2. Question 2Author and Manage Workflows

    In a GitHub Actions workflow YAML file, what key defines the event that triggers the workflow?

    Atrigger
    Bon
    Cwhen
    Devents
    Show Answer & Explanation
    Correct Answer: B
    Explanation:

    The on: key specifies the event(s) that trigger the workflow, e.g., on: push, on: pull_request, or on: schedule.

  3. Question 3Author and Manage Workflows

    By default, how do jobs in a GitHub Actions workflow run?

    ASequentially, one after another
    BIn parallel
    CIn alphabetical order
    DOnly one job can exist per workflow
    Show Answer & Explanation
    Correct Answer: B
    Explanation:

    Jobs run in parallel by default. The needs: keyword creates dependencies to run them sequentially.

  4. Question 4Author and Manage Workflows

    Which trigger allows a workflow to be started manually from the GitHub UI or via the API?

    Aworkflow_run
    Brepository_dispatch
    Cworkflow_dispatch
    Dmanual_trigger
    Show Answer & Explanation
    Correct Answer: C
    Explanation:

    workflow_dispatch allows manual triggering from the GitHub UI or REST API, optionally accepting input parameters.

  5. Question 5Author and Manage Workflows

    What is the smallest unit of work in a GitHub Actions workflow?

    AWorkflow
    BJob
    CStep
    DRunner
    Show Answer & Explanation
    Correct Answer: C
    Explanation:

    Steps are the individual tasks within a job. Each step runs a shell command (run:) or uses an action (uses:).

  6. Question 6Author and Manage Workflows

    What file format is used to write GitHub Actions workflows?

    AJSON
    BTOML
    CYAML
    DXML
    Show Answer & Explanation
    Correct Answer: C
    Explanation:

    GitHub Actions workflows are written in YAML files stored in .github/workflows/ in the repository.

  7. Question 7Author and Manage Workflows

    Where must GitHub Actions workflow files be placed in a repository?

    A/.workflows/ directory
    B/.github/workflows/ directory
    C/actions/ directory
    DAny directory, as long as the file ends in .yml
    Show Answer & Explanation
    Correct Answer: B
    Explanation:

    Workflow files must be in the .github/workflows/ directory at the root of the repository.

  8. Question 8Consume and Troubleshoot Workflows

    How do you call a reusable workflow from another workflow in GitHub Actions?

    Auses: ./.github/workflows/reusable.yml
    Bimport: ./.github/workflows/reusable.yml
    Cinclude: reusable.yml
    Dworkflow_call: .github/workflows/reusable.yml
    Show Answer & Explanation
    Correct Answer: A
    Explanation:

    You reference a reusable workflow from a job with uses: pointing to the workflow file path. The reusable workflow must use the workflow_call trigger.

  9. Question 9Author and Manage Workflows

    Which action caches dependencies in GitHub Actions to speed up workflows?

    Aactions/setup-cache
    Bactions/cache
    Cactions/save-artifacts
    Dactions/restore
    Show Answer & Explanation
    Correct Answer: B
    Explanation:

    actions/cache saves and restores files (e.g., node_modules, pip packages) between runs to reduce download times.

  10. Question 10Manage GitHub Actions for the Enterprise

    How do you target a specific self-hosted runner in a GitHub Actions workflow?

    ABy setting the runner IP address in the workflow
    BBy using labels in the runs-on: field of a job
    CBy naming the runner the same as the job name
    DSelf-hosted runners are always selected automatically
    Show Answer & Explanation
    Correct Answer: B
    Explanation:

    Self-hosted runners have labels. You target them in a job with runs-on: [self-hosted, linux, arm64] for example.

  11. Question 11Secure and Optimize Automation

    In GitHub Actions, how do you reference an encrypted secret named API_KEY in a workflow step?

    A${{ secret.API_KEY }}
    B${{ secrets.API_KEY }}
    Cenv:API_KEY
    D${{ env.secrets.API_KEY }}
    Show Answer & Explanation
    Correct Answer: B
    Explanation:

    Encrypted secrets are accessed with the secrets context: ${{ secrets.SECRET_NAME }}. They are never exposed in logs.

  12. Question 12Author and Maintain Workflows

    Where must GitHub Actions workflow files be stored?

    AIn the root directory
    BIn the .github/workflows/ directory
    CIn the src/ directory
    DIn any directory
    Show Answer & Explanation
    Correct Answer: B
    Explanation:

    Workflow YAML files must be in the .github/workflows/ directory to be discovered and executed by GitHub Actions.

  13. Question 13Author and Maintain Workflows

    Which keyword defines the events that trigger a workflow?

    Aruns-on
    Bsteps
    Con
    Djobs
    Show Answer & Explanation
    Correct Answer: C
    Explanation:

    The 'on' keyword specifies which events (push, pull_request, schedule, workflow_dispatch, etc.) trigger the workflow execution.

  14. Question 14Author and Maintain Workflows

    What is the purpose of 'workflow_dispatch' trigger?

    AAutomatic trigger on push
    BAllows manual triggering of a workflow from the GitHub UI or API with optional input parameters
    CScheduled trigger
    DTrigger on issue creation
    Show Answer & Explanation
    Correct Answer: B
    Explanation:

    workflow_dispatch enables manual workflow execution from the Actions tab or REST API, with support for custom input parameters that can be used in the workflow.

  15. Question 15Consume Workflows

    How do you debug a failing GitHub Actions workflow?

    AOnly read error messages
    BEnable debug logging (ACTIONS_RUNNER_DEBUG secret), add debug echo statements, use tmate for SSH access, and analyze step logs
    CCannot debug workflows
    DContact GitHub support
    Show Answer & Explanation
    Correct Answer: B
    Explanation:

    Debug strategies: set ACTIONS_STEP_DEBUG=true secret for verbose logs, add 'echo' statements, use tmate action for SSH into runner, check step annotations, and use act for local testing.

  16. Question 16Author and Maintain Workflows

    How do you handle secrets in GitHub Actions workflows?

    AHardcode in YAML
    BStore in repository or organization Settings > Secrets, reference as ${{ secrets.NAME }}, and they are automatically masked in logs
    CEnvironment variables in code
    DPlain text files
    Show Answer & Explanation
    Correct Answer: B
    Explanation:

    Secrets management: store encrypted in Settings (repo, org, or environment level). Reference: ${{ secrets.MY_SECRET }}. Auto-masked: if printed to log, shown as ***. Never echo secrets for debugging. Rotate regularly. For cloud auth: prefer OIDC over stored credentials.

  17. Question 17Consume Workflows

    What are GitHub Actions starter workflows?

    ADefault workflows
    BPre-configured workflow templates provided by GitHub and organizations, available when setting up Actions for the first time, covering common CI/CD patterns for various languages
    CTraining courses
    DDemo workflows
    Show Answer & Explanation
    Correct Answer: B
    Explanation:

    Starter workflows: templates in .github/workflows/ when you click 'New workflow'. GitHub provides: language-specific CI (Node.js, Python, Java), deployment (Azure, AWS, GCP), security (CodeQL), and custom org starters. Org: create in .github repo's workflow-templates/ directory.

  18. Question 18Manage Actions and Workflows

    How do you debug failing GitHub Actions workflows?

    ACannot debug
    BEnable debug logging with ACTIONS_STEP_DEBUG secret, check run logs in Actions tab, use 'act' for local testing, and add diagnostic steps to workflows
    COnly re-run workflow
    DOnly check email
    Show Answer & Explanation
    Correct Answer: B
    Explanation:

    Debugging: enable step debug logging (ACTIONS_STEP_DEBUG=true secret), runner diagnostic logging (ACTIONS_RUNNER_DEBUG=true), review logs per step in Actions tab, add diagnostic steps (env, ls, cat), use 'act' locally, and tmate/mxschmitt/action-tmate for interactive debugging.

  19. Question 19Author and Maintain Workflows

    What are expressions and functions in GitHub Actions?

    AProgramming code
    B${{ }} syntax for dynamic values, with built-in functions like contains(), startsWith(), format(), toJSON(), hashFiles(), and context objects like github, env, steps
    CTemplate literals
    DShell variables
    Show Answer & Explanation
    Correct Answer: B
    Explanation:

    Expressions: ${{ expression }}. Contexts: github (event data), env, job, steps, runner, secrets, inputs, matrix. Functions: contains(), startsWith(), endsWith(), format(), join(), toJSON(), fromJSON(), hashFiles(), success(), failure(), cancelled(), always(). Operators: ==, !=, &&, ||, !.

  20. Question 20Manage Actions and Workflows

    How do you secure GitHub Actions workflows?

    ANo security needed
    BPin actions to SHA (not tags), use least-privilege GITHUB_TOKEN permissions, avoid script injection in expressions, use environments with protection rules, and audit third-party actions
    CUse latest always
    DTrust all actions
    Show Answer & Explanation
    Correct Answer: B
    Explanation:

    Security practices: pin to SHA (uses: actions/checkout@abc123def), least privilege (permissions: read-all), avoid script injection (don't use ${{ github.event.issue.title }} in run:), use environments (required reviewers for prod), Dependabot for action updates, restrict fork PR permissions, and OpenSSF Scorecard for action assessment.

  21. Question 21Consume Workflows

    How do you pass data between jobs in a workflow?

    AShared filesystem
    BUsing job outputs and the 'needs' keyword, or artifacts
    CGlobal environment variables
    DDirect function calls
    Show Answer & Explanation
    Correct Answer: B
    Explanation:

    Jobs run on separate runners, so data passes via job outputs (needs.<job>.outputs.<name>) for small values or upload/download-artifact actions for files.

  22. Question 22Author and Maintain Workflows

    How do you share data between jobs in a workflow?

    AJobs automatically share all data
    BUse artifacts (upload/download-artifact), workflow outputs, or caching for dependencies — jobs run on separate runners and don't share filesystems
    CShared filesystem
    DGlobal variables
    Show Answer & Explanation
    Correct Answer: B
    Explanation:

    Jobs run on separate runners. Share via: artifacts (upload in job A, download in job B), job outputs ('outputs' key + needs dependency), and cache (actions/cache for dependencies). Each method has different persistence and use cases.

  23. Question 23Consume Workflows

    What are composite run steps in reusable workflows?

    ACannot combine
    BReusable workflows can contain multiple jobs with their own steps, and composite actions can combine run commands and action references into a single reusable unit
    COnly one step allowed
    DOnly shell commands
    Show Answer & Explanation
    Correct Answer: B
    Explanation:

    Composite actions vs reusable workflows: Composite actions: combine steps (run + uses) into one action, referenced like any action (uses: ./my-action). Reusable workflows: full workflow with jobs, called via workflow_call (uses: org/repo/.github/workflows/ci.yml@main). Key differences: composite runs in caller's job, reusable runs as separate jobs. Choose composite for: step-level reuse. Choose reusable workflows for: job-level reuse with separate runners.

Key Workflow Syntax Concepts for GH-ACTIONS

workflowyamltriggeronjobsstepsactionsexpressions

GH-ACTIONS Workflow Syntax Exam Tips

Workflow Syntax & Structure questions in GH-ACTIONS are typically scenario-based. Focus on service-level decision making aligned to official exam objectives. Priority concepts: workflow, yaml, trigger, on, jobs, steps.

What GH-ACTIONS Expects

  • Anchor your answer in select the most practical, secure, and scalable answer for the stated scenario.
  • Workflow Syntax scenarios for GH-ACTIONS are frequently mapped to Domain 1 (40%), so read the objective carefully before picking controls or architecture.
  • Expect multi-service scenarios where Workflow Syntax interacts with IAM, networking, storage, or observability patterns rather than appearing as an isolated service question.
  • When two options are both technically valid, prefer the choice that best aligns with the exam's operational scope (Intermediate) and managed-service best practices.

High-Value Workflow Syntax Concepts

  • Know the core Workflow Syntax building blocks cold: workflow, yaml, trigger, on.
  • Review the edge-case features and limits for jobs, steps; these details are commonly used to differentiate answer choices.
  • Practice service-integration reasoning: how Workflow Syntax pairs with CI/CD, Custom Actions in real deployment patterns.
  • For GH-ACTIONS, explain why the chosen Workflow Syntax design meets reliability, security, and cost expectations better than the alternatives.

Common GH-ACTIONS Traps

  • Watch for answers that partially solve the requirement but miss operational constraints.
  • Questions in Author and Maintain Workflows often include distractors that look correct for Workflow Syntax but violate least-privilege, durability, or availability requirements.
  • Avoid picking options purely by feature name; validate data path, failure handling, and governance impact before answering.
  • If the prompt hints at automation or repeatability, eliminate manual-only operational answers first.

Fast Review Checklist

  • Can you compare at least two Workflow Syntax implementation paths and justify which one best fits the scenario?
  • Can you map the chosen answer back to Author and Maintain Workflows (40%) outcomes for GH-ACTIONS?
  • Can you explain security and access boundaries for Workflow Syntax without relying on default-open assumptions?
  • Can you describe how Workflow Syntax integrates with CI/CD and Custom Actions during failure, scaling, and monitoring events?

Exam Domains Covering Workflow Syntax

Related Resources

More GH-ACTIONS Study Resources