Microsoft Certification

GH-200 — GitHub Actions Study Guide

60 practice questions with correct answers and detailed explanations. Use this guide to review concepts before taking the practice exam.

▶ Take Practice Exam 60 questions  ·  Free  ·  No registration

About the GH-200 Exam

The Microsoft GitHub Actions (GH-200) certification validates professional expertise in Microsoft technologies. This study guide covers all 60 practice questions from our GH-200 practice test, complete with correct answers and explanations to help you understand each concept thoroughly.

Review each question and explanation below, then test yourself with the full interactive practice exam to measure your readiness.

60 Practice Questions & Answers

Q1 Easy

What is the primary purpose of using GitHub Actions secrets?

  • A To cache dependencies for faster workflow execution
  • B To restrict access to specific branches in a workflow
  • C To define environment variables for all repositories
  • D To store sensitive information like API keys and credentials securely ✓ Correct
Explanation

GitHub Actions secrets are encrypted environment variables that securely store sensitive data like API keys, tokens, and credentials, preventing them from being exposed in logs or version control.

Q2 Medium

Which trigger event is used to execute a workflow when a pull request review is submitted?

  • A on: review_requested
  • B on: code_review
  • C on: pull_request_target
  • D on: pull_request_review ✓ Correct
Explanation

The `pull_request_review` event trigger fires when a review is submitted on a pull request, allowing workflows to respond to review actions like approvals or changes requested.

Q3 Medium

What does the `github.context` object provide in a GitHub Actions workflow?

  • A A cached version of previously successful workflow runs
  • B Real-time monitoring data for all runners
  • C A structured object containing information about the workflow run and triggering event ✓ Correct
  • D Configuration settings for the GitHub repository only
Explanation

`github.context` is a built-in object that provides detailed information about the workflow execution, including the triggering event, repository data, and actor information.

Q4 Medium

When using a matrix strategy in GitHub Actions, how are jobs executed?

  • A Jobs run only if previous jobs succeed
  • B Jobs run sequentially one after another
  • C Jobs run only on the primary branch
  • D Jobs run in parallel based on the matrix combinations defined ✓ Correct
Explanation

A matrix strategy creates multiple job instances running in parallel, with each combination of the matrix variables executing simultaneously, enabling efficient testing across different configurations.

Q5 Easy

Which expression syntax is used to conditionally execute a step in GitHub Actions?

  • A execute: ${{ condition }}
  • B if: ${{ condition }} ✓ Correct
  • C when: ${{ condition }}
  • D run_if: ${{ condition }}
Explanation

The `if:` keyword with `${{ }}` expression syntax allows conditional execution of steps, jobs, or actions based on specific conditions evaluated at runtime.

Q6 Easy

What is the purpose of the `uses` keyword in a GitHub Actions step?

  • A To define environment variables for the current step
  • B To reference and execute a reusable action from the GitHub Marketplace or a repository ✓ Correct
  • C To specify which shell interpreter to use for the step
  • D To indicate which artifact to download before running the step
Explanation

The `uses` keyword specifies a reusable action to execute, allowing workflows to leverage pre-built actions from the GitHub Marketplace or custom actions defined in repositories.

Q7 Medium

How can you access outputs from a previous step in GitHub Actions?

  • A Using ${{ previous.outputs.output_name }}
  • B Using ${{ steps.step_id.outputs.output_name }} ✓ Correct
  • C Using ${{ environment.step_outputs }}
  • D Using ${{ job.outputs.output_name }}
Explanation

Step outputs are accessed using the `${{ steps.<step-id>.outputs.<output-name> }}` syntax, allowing data to flow between steps in a job.

Q8 Easy

What does the `runs-on` keyword specify in a GitHub Actions workflow?

  • A The branch that the workflow should monitor for changes
  • B The permissions level required to execute the workflow
  • C The operating system and hardware configuration where the job will execute ✓ Correct
  • D The time when the workflow should start executing
Explanation

`runs-on` specifies the runner type (e.g., ubuntu-latest, windows-latest, macos-latest, or self-hosted) that will execute the job steps.

Q9 Medium

Which approach allows you to reuse workflow logic across multiple repositories?

  • A Storing workflows in a shared NPM package
  • B Copying the YAML workflow files to each repository manually
  • C Using GitHub Gists to store workflow definitions
  • D Using composite actions or reusable workflows with the `workflow_call` event ✓ Correct
Explanation

Composite actions and reusable workflows (triggered by `workflow_call`) enable code reuse across repositories, with reusable workflows being called from other workflows or repositories.

Q10 Medium

What is the default shell used when the `shell` keyword is not specified in a step?

  • A Always Bash regardless of the runner type
  • B The shell configured in the runner's environment variables
  • C PowerShell on Windows runners, Bash on Linux and macOS runners ✓ Correct
  • D Always PowerShell regardless of the runner type
Explanation

By default, GitHub Actions uses platform-specific shells: PowerShell on Windows runners and Bash on Linux and macOS runners, unless explicitly specified otherwise.

Q11 Medium

How can you prevent a job from running if a previous job fails?

  • A By using `depends_on: job_id` keyword
  • B By setting `fail_fast: true` in the job configuration
  • C By using `needs: job_id` and `if: success()` or letting job dependencies handle it automatically ✓ Correct
  • D By using `requires: job_id` in the workflow
Explanation

Using the `needs` keyword establishes job dependencies, and jobs will fail by default if a dependency fails unless explicitly overridden with conditions like `if: always()`.

Q12 Medium

What does the `artifacts` feature in GitHub Actions allow you to do?

  • A Version control binary files in the GitHub repository
  • B Encrypt sensitive files before committing to the repository
  • C Store and share files between jobs or download them after workflow completion ✓ Correct
  • D Cache dependencies permanently across all workflows
Explanation

Artifacts allow you to persist files generated during workflow execution, share them between jobs, and make them available for download after the workflow completes.

Q13 Medium

Which environment variable contains the name of the branch or tag that triggered the workflow?

  • A ${{ github.ref_name }} ✓ Correct
  • B ${{ github.base_ref }}
  • C ${{ github.trigger_ref }}
  • D ${{ github.branch }}
Explanation

`github.ref_name` contains the branch or tag name that triggered the workflow, providing the short ref name without the 'refs/heads/' or 'refs/tags/' prefix.

Q14 Medium

What is the maximum timeout duration for a single job in GitHub Actions?

  • A 60 minutes (1 hour)
  • B 360 minutes (6 hours) ✓ Correct
  • C 120 minutes (2 hours)
  • D 1440 minutes (24 hours)
Explanation

GitHub Actions jobs have a maximum timeout of 360 minutes (6 hours), after which they are automatically terminated regardless of their status.

Q15 Medium

How can you specify different environment variables for different jobs in a workflow?

  • A By using GitHub Secrets exclusively for all job-specific variables
  • B By creating separate workflow files for each job
  • C By modifying the runner's global environment before job execution
  • D By defining `env` at the job level or using separate environment configurations for each job ✓ Correct
Explanation

Environment variables can be defined at the job level under `env:`, allowing different jobs to have their own set of variables without affecting other jobs in the workflow.

Q16 Hard

What does the `workflow_run` trigger event enable you to do?

  • A Automatically rollback changes if a workflow fails
  • B Execute a workflow in response to another workflow completing, regardless of its status ✓ Correct
  • C Schedule workflows to run at specific times of the day
  • D Monitor real-time execution of currently running workflows
Explanation

`workflow_run` is an event trigger that fires when another workflow completes (successfully or not), enabling dependent workflows or cleanup operations based on the completion of a primary workflow.

Q17 Hard

How do you configure GitHub Actions to use a self-hosted runner instead of GitHub-hosted runners?

  • A By configuring webhooks to route jobs to an internal server
  • B By setting `runs-on: self-hosted` and registering a runner in the repository or organization settings ✓ Correct
  • C By creating a custom runner image in Docker and pushing it to a registry
  • D By installing GitHub Actions software on your server and using `runs-on: local`
Explanation

Self-hosted runners are registered through repository or organization settings using the GitHub Actions runner application, then referenced in workflows with `runs-on: self-hosted` or custom labels.

Q18 Hard

What is the purpose of the `concurrency` keyword in GitHub Actions workflows?

  • A To increase the number of parallel jobs that can execute simultaneously
  • B To specify the maximum CPU threads available to a job
  • C To prevent multiple workflow runs from executing concurrently using a concurrency group identifier ✓ Correct
  • D To limit the number of matrix combinations in a job
Explanation

The `concurrency` keyword ensures that only one workflow run in a concurrency group executes at a time, canceling in-progress runs when a new run is triggered, useful for preventing race conditions.

Q19 Hard

How can you conditionally skip a workflow based on commit messages?

  • A By checking `github.event.head_commit.message` in the `if` condition of the first job ✓ Correct
  • B By configuring branch protection rules to prevent workflow execution
  • C By using the `[skip ci]` tag in all commit messages you want to skip
  • D By adding workflow skip directives in the repository settings
Explanation

You can conditionally execute or skip workflows by using `if` conditions that check `github.event.head_commit.message` for specific patterns or keywords.

Q20 Medium

What does the `continue-on-error` keyword do in a GitHub Actions step?

  • A Sends an error notification to the repository maintainers
  • B Rolls back changes made by the step if it fails
  • C Allows the job to continue executing subsequent steps even if the current step fails ✓ Correct
  • D Automatically retries the failed step before proceeding
Explanation

`continue-on-error: true` on a step prevents the job from failing immediately, allowing subsequent steps to execute even if that step fails.

Q21 Easy

Which action context provides information about the repository where the workflow is running?

  • A ${{ context.repository }}
  • B ${{ github.repository }} ✓ Correct
  • C ${{ github.repo_info }}
  • D ${{ github.repo_context }}
Explanation

`github.repository` provides the repository name in the format `owner/repo`, giving you quick access to the repository identifier within your workflow.

Q22 Hard

What is a composite action in GitHub Actions and when would you use it?

  • A An action that can only be used within Docker containers
  • B A reusable action that combines multiple run steps or calls to other actions into a single action, useful for grouping related commands ✓ Correct
  • C An action that automatically merges multiple workflow files into one
  • D An action that combines the results of parallel jobs into a single output
Explanation

Composite actions allow you to create reusable action units containing multiple shell or action steps, enabling better code organization and reusability across workflows and repositories.

Q23 Hard

How can you securely pass data between jobs in a workflow without using artifacts?

  • A By using job outputs and the `needs` context to reference outputs from previous jobs ✓ Correct
  • B By using GitHub's internal cache system to store job results
  • C By writing data to environment files that are automatically shared between jobs
  • D By storing data in GitHub Secrets and retrieving it in each job
Explanation

Job outputs can be defined and accessed between jobs using `needs.<job-id>.outputs.<output-name>` syntax, allowing secure data passing without artifacts.

Q24 Hard

What does the `permissions` keyword control in a GitHub Actions workflow?

  • A The operating system-level file permissions for the runner
  • B The network connectivity permissions for the runner environment
  • C The GitHub API permissions and GITHUB_TOKEN scopes for the workflow's access rights ✓ Correct
  • D User access levels to the repository and branch protection rules
Explanation

The `permissions` keyword specifies the scope of the GITHUB_TOKEN, controlling what GitHub API operations the workflow can perform, enhancing security through least-privilege access.

Q25 Hard

How would you configure a workflow to run only on specific labels being added to a pull request?

  • A By using `on: pull_request: types: [labeled]` and checking `github.event.label.name` in a condition ✓ Correct
  • B By creating a separate workflow file for each label
  • C By using a scheduled trigger with label monitoring
  • D By configuring webhook filters in the repository settings
Explanation

The `labeled` activity type for pull request events triggers when labels are added, and you can filter specific labels using `if: github.event.label.name == 'desired-label'`.

Q26 Easy

What is the primary purpose of GitHub Actions?

  • A To manually deploy applications to production servers
  • B To provide version control for infrastructure-as-code files
  • C To automate software development workflows directly within GitHub repositories ✓ Correct
  • D To store encrypted secrets and credentials for local development
Explanation

GitHub Actions is a CI/CD platform that enables automation of build, test, and deployment workflows directly in your GitHub repository.

Q27 Easy

Which file format is used to define GitHub Actions workflows?

  • A YAML ✓ Correct
  • B JSON
  • C XML
  • D TOML
Explanation

GitHub Actions workflows are defined in YAML format and stored in the .github/workflows directory of a repository.

Q28 Easy

What is the difference between a GitHub Action and a GitHub Actions workflow?

  • A An action runs locally, while a workflow runs on GitHub servers only
  • B An action is a reusable unit of code, while a workflow is an automated process composed of one or more actions ✓ Correct
  • C There is no difference; the terms are synonymous
  • D A workflow is a reusable unit of code, while an action is a collection of workflows
Explanation

An action is a reusable custom application or piece of code that performs a task. A workflow is an automated process that uses one or more actions.

Q29 Medium

In a GitHub Actions workflow, what does the 'on' keyword specify?

  • A The runner specifications for job execution
  • B The permissions required for the workflow to execute
  • C The event or events that trigger the workflow to run ✓ Correct
  • D The environment variables available to the workflow
Explanation

The 'on' keyword defines the events that automatically trigger a workflow, such as push, pull_request, or schedule events.

Q30 Medium

Which of the following is NOT a valid way to trigger a GitHub Actions workflow?

  • A On a specific file modification in the .github/workflows directory only ✓ Correct
  • B On a push event to the repository
  • C On a scheduled cron expression
  • D On manual trigger using workflow_dispatch
Explanation

While workflows can be triggered on many events including push, schedule, and manual dispatch, they are not automatically limited to triggering only on .github/workflows directory changes.

Q31 Medium

What is the purpose of the 'runs-on' keyword in a GitHub Actions job?

  • A To define the operating system and version of the runner that will execute the job ✓ Correct
  • B To set the timeout duration for the job execution
  • C To specify which branch the job should execute on
  • D To indicate which GitHub Actions should be used in the job
Explanation

The 'runs-on' keyword specifies the type of machine (runner) on which the job will execute, such as ubuntu-latest, windows-latest, or a self-hosted runner.

Q32 Medium

Which of the following best describes a GitHub-hosted runner?

  • A A Docker container that must be configured manually before each workflow run
  • B A lightweight agent that runs only on pull request events
  • C A virtual machine managed by GitHub that executes workflow jobs ✓ Correct
  • D A physical server located in your organization's data center
Explanation

GitHub-hosted runners are virtual machines managed by GitHub that are available for running workflow jobs without any configuration needed.

Q33 Medium

When would you use a self-hosted runner instead of a GitHub-hosted runner?

  • A When you want to reduce the number of GitHub Actions minutes used
  • B When your workflow requires access to resources within your private network or specific hardware requirements ✓ Correct
  • C When your organization has more than 100 repositories
  • D When you need to run workflows faster than GitHub's infrastructure allows
Explanation

Self-hosted runners are used when workflows need access to private network resources, require specific hardware, or need to comply with organizational security policies.

Q34 Medium

What does the 'steps' keyword define in a GitHub Actions workflow job?

  • A The approval gates required before the job can run
  • B The sequence of tasks that will be executed as part of the job ✓ Correct
  • C The environmental variables passed between different jobs
  • D The dependencies that must be installed before the job starts
Explanation

The 'steps' keyword contains an array of tasks that execute sequentially in a job. Each step can be an action or a shell command.

Q35 Medium

In a GitHub Actions workflow, what is the difference between 'uses' and 'run' in a step?

  • A 'uses' is deprecated and should be replaced with 'run' in all modern workflows
  • B 'uses' executes a shell command, while 'run' executes an action or Docker container
  • C 'uses' is for GitHub-hosted runners only, while 'run' is for self-hosted runners
  • D 'uses' executes an action or references a Docker container, while 'run' executes shell commands ✓ Correct
Explanation

The 'uses' keyword invokes an action or Docker container, while 'run' executes arbitrary shell commands directly on the runner.

Q36 Medium

How are GitHub Actions secrets accessed within a workflow step?

  • A By using the 'secrets' context syntax like ${{ secrets.SECRET_NAME }} ✓ Correct
  • B By reading from a secrets.json file in the repository
  • C By passing them as command-line arguments to the runner
  • D By referencing them directly by name as environment variables like $SECRET_NAME
Explanation

Secrets are accessed using the ${{ secrets.SECRET_NAME }} syntax within workflow steps, which ensures they are not logged in workflow output.

Q37 Medium

What is the scope of a secret created at the repository level in GitHub Actions?

  • A The secret is available only to workflows in that specific repository ✓ Correct
  • B The secret is available to all workflows across all repositories in the organization
  • C The secret is available only to the person who created it
  • D The secret is available to the repository and all its forks
Explanation

Repository-level secrets are accessible only to workflows within that specific repository, not across other repositories or forks.

Q38 Medium

When should you use organization-level secrets instead of repository-level secrets?

  • A When the secret is more sensitive and requires additional encryption
  • B When you have more than 10 repositories requiring the same secret
  • C When you need a secret to be shared across multiple repositories in the organization ✓ Correct
  • D When you want to prevent accidental exposure of sensitive data
Explanation

Organization-level secrets are used when you need to share the same secret value across multiple repositories within an organization.

Q39 Hard

What is the maximum number of jobs that can run simultaneously in a single GitHub Actions workflow run?

  • A There is no hard limit; it depends on your GitHub plan and concurrent job capacity ✓ Correct
  • B 5 jobs maximum
  • C 10 jobs maximum
  • D 1 job at a time; all jobs must run sequentially
Explanation

The number of jobs that can run concurrently depends on your GitHub plan, runner availability, and concurrent job limits rather than a fixed number.

Q40 Medium

How do you make a job dependent on another job in a GitHub Actions workflow?

  • A By using the 'depends_on' keyword in the dependent job
  • B By defining jobs in sequential order in the workflow file
  • C By creating a separate workflow file for each dependent job
  • D By using the 'needs' keyword to specify job dependencies ✓ Correct
Explanation

The 'needs' keyword specifies that a job must complete before another job runs. A job that 'needs' another job will not start until the required job completes successfully.

Q41 Hard

What happens when a job that other jobs depend on fails in a GitHub Actions workflow?

  • A The dependent jobs are automatically skipped unless explicitly configured otherwise ✓ Correct
  • B The entire workflow stops immediately, and no further jobs run
  • C The dependent jobs run but with a warning status
  • D The dependent jobs continue to run as scheduled
Explanation

By default, when a job fails, jobs that depend on it are skipped. You can override this using 'continue-on-error' or conditional logic.

Q42 Medium

What is the purpose of the 'if' conditional in a GitHub Actions workflow step?

  • A To specify which runner type should execute the step
  • B To skip or execute a step based on a condition ✓ Correct
  • C To loop through multiple iterations of a step
  • D To define error handling and recovery strategies
Explanation

The 'if' conditional allows you to execute or skip a step based on a condition, such as checking the success of a previous step or evaluating a variable.

Q43 Hard

Which context is available to access information about the current workflow run in GitHub Actions?

  • A The 'github' context, which contains information about the event, repository, and runner ✓ Correct
  • B The 'runner' context, which contains only hardware specifications
  • C The 'job' context, which is not available during workflow execution
  • D The 'workflow' context, which contains only the workflow file name and path
Explanation

The 'github' context provides comprehensive information about the workflow run, including event details, repository info, and the triggering event payload.

Q44 Medium

What is the difference between the 'env' keyword at the workflow level versus at the job level?

  • A There is no functional difference; both are identical
  • B Job-level env variables are shared across all jobs; workflow-level variables are private
  • C Workflow-level variables can be secrets, while job-level cannot
  • D Workflow-level env variables are global to all jobs; job-level env variables are scoped to that job ✓ Correct
Explanation

Environment variables defined at the workflow level are available to all jobs, while job-level env variables are only available to that specific job and its steps.

Q45 Hard

What is the purpose of the 'matrix' strategy in GitHub Actions?

  • A To run the same job with different configurations across multiple runners in parallel ✓ Correct
  • B To create a dependency tree of jobs that must run sequentially
  • C To limit the number of concurrent jobs in a workflow
  • D To define fallback runners if the primary runner fails
Explanation

The 'matrix' strategy allows you to create multiple job variations that run in parallel with different input values, useful for testing across multiple Node versions or operating systems.

Q46 Hard

How can you exclude specific combinations from running in a GitHub Actions matrix strategy?

  • A By using conditional 'if' statements in each job definition
  • B By manually removing unwanted combinations before the workflow starts
  • C By using the 'exclude' keyword to specify combinations that should not run ✓ Correct
  • D By using the 'skip' keyword in the matrix definition
Explanation

The 'exclude' keyword in the matrix strategy allows you to prevent specific combinations of matrix variables from creating jobs.

Q47 Medium

What is the default timeout for a GitHub Actions job?

  • A Unlimited; timeout must be explicitly configured
  • B 15 minutes
  • C 30 minutes
  • D 360 minutes (6 hours) ✓ Correct
Explanation

GitHub Actions jobs have a default timeout of 360 minutes (6 hours). This can be customized using the 'timeout-minutes' keyword.

Q48 Hard

How do you pass output from one job to another job in a GitHub Actions workflow?

  • A By setting environment variables at the workflow level
  • B By using the job outputs feature with the 'outputs' keyword and accessing them via the 'needs' context ✓ Correct
  • C By using shell variables that persist across jobs automatically
  • D By writing data to a shared file that all jobs can access
Explanation

Job outputs are defined using the 'outputs' keyword in a job, and dependent jobs can access them via the 'needs' context like ${{ needs.job_id.outputs.output_name }}.

Q49 Hard

What is the purpose of the 'concurrency' keyword in a GitHub Actions workflow?

  • A To distribute jobs across multiple runners
  • B To increase the number of parallel jobs that can run
  • C To ensure that only one workflow with the same concurrency group runs at a time, canceling previous runs ✓ Correct
  • D To set the maximum execution time for concurrent operations
Explanation

The 'concurrency' keyword groups workflows and ensures that only one workflow in that group runs at a time, automatically canceling in-progress runs if a new one starts.

Q50 Hard

How do you create a composite action in GitHub Actions?

  • A By defining a composite action in an action.yml file with 'runs' of type 'composite' and listing steps ✓ Correct
  • B By creating a shell script in the .github/actions directory
  • C By writing a custom JavaScript file that imports other action modules
  • D By combining multiple existing actions in a single workflow file
Explanation

A composite action is created by defining an action.yml file with 'runs: using: composite' and specifying the steps that make up the composite action.

Q51 Medium

When you use the 'uses' keyword in a GitHub Actions workflow, what types of actions can be referenced?

  • A Only JavaScript actions stored in the GitHub Marketplace
  • B Only Docker container actions from Docker Hub
  • C Public actions from GitHub Marketplace, private actions in your repository, or Docker images from any registry ✓ Correct
  • D Actions that are written exclusively in YAML format
Explanation

The 'uses' keyword can reference public actions from GitHub Marketplace, private actions within your own repository (using relative paths), Docker container actions, or Docker images from any container registry.

Q52 Medium

What is the primary purpose of the 'github.context' object in GitHub Actions workflows?

  • A To provide information about the workflow run, triggering event, and repository details that can be accessed throughout the workflow ✓ Correct
  • B To encrypt sensitive data before storing it in workflow environment variables
  • C To define which runners are available for job execution
  • D To configure the Docker container runtime environment settings
Explanation

The github.context object contains comprehensive information about the workflow execution, including event payload details, repository information, and actor details, making it accessible for use in expressions and scripts throughout the workflow.

Q53 Hard

In GitHub Actions, what does the 'concurrency' keyword do?

  • A It increases the number of parallel jobs that can run simultaneously in a workflow
  • B It ensures that only one workflow run with the same concurrency group executes at a time, canceling any in-progress runs when a new one is triggered ✓ Correct
  • C It restricts the workflow to execute only on specific runner labels or machine types
  • D It defines the timeout duration for individual job steps
Explanation

The concurrency keyword allows you to cancel any in-progress job or workflow run in the same concurrency group, ensuring that only one run executes at a time—useful for preventing simultaneous deployments or resource conflicts.

Q54 Medium

Which of the following scenarios would require using a self-hosted runner instead of a GitHub-hosted runner?

  • A When your workflow needs to access internal resources on a private network that are not accessible from GitHub's IP address ranges ✓ Correct
  • B When the workflow only contains simple shell scripts that don't require external dependencies
  • C When you want to reduce costs by using pre-paid cloud instances for all workflow executions
  • D When you need the absolute fastest execution time possible for your CI/CD pipeline
Explanation

Self-hosted runners are necessary when workflows need access to internal, on-premises resources or private networks that GitHub-hosted runners cannot reach due to network restrictions.

Q55 Easy

What is the correct syntax to pass a secret stored in GitHub repository settings to a workflow step?

  • A ${{ secrets.MY_SECRET }} ✓ Correct
  • B ${{ github.MY_SECRET }}
  • C ${{ env.MY_SECRET }}
  • D ${{ runner.MY_SECRET }}
Explanation

Secrets stored in repository settings are accessed using the 'secrets' context with the syntax ${{ secrets.SECRET_NAME }} in workflow files and scripts.

Q56 Medium

When defining a composite action, what files must be included in the action's directory?

  • A A package.json file, a main.js entry point, and an action.yml file
  • B A 'action.yml' metadata file and optionally any scripts or source code files that the action executes ✓ Correct
  • C Only a Dockerfile and a .yml configuration file
  • D Multiple YAML files organized in a specific directory structure defined by GitHub
Explanation

Composite actions require an action.yml metadata file that defines the action's inputs, outputs, and run steps. The directory can also contain any scripts or code that the action needs to execute.

Q57 Medium

How can you conditionally execute a step in a GitHub Actions workflow based on the outcome of a previous step?

  • A By defining separate workflows for each possible outcome and triggering them manually
  • B By using environment variables that are automatically set based on step outcomes
  • C By using the 'if' conditional with a success() or failure() function that references the previous step's status ✓ Correct
  • D By implementing try-catch blocks in your shell scripts within each step
Explanation

GitHub Actions provides conditional functions like success(), failure(), and always() that can be used in the 'if' statement to control step execution based on previous step outcomes.

Q58 Hard

What is the difference between GitHub-hosted runners and the specific runner sizes available?

  • A Different runner sizes are only relevant for self-hosted runners and have no impact on GitHub-hosted runner performance
  • B Runner sizes are purely cosmetic labels with no actual performance implications on workflow execution
  • C Runner sizes determine the processing power, memory, and storage capacity allocated to each job, with different sizes available for different operating systems and pricing ✓ Correct
  • D GitHub-hosted runners automatically scale to match the resource demands of your workflow without requiring size specification
Explanation

GitHub offers different runner sizes (standard, large, xlarge, etc.) with varying CPU, memory, and storage resources. Larger sizes provide better performance for resource-intensive workloads but consume more billable minutes.

Q59 Medium

In a GitHub Actions workflow, what does the 'strategy.matrix' keyword enable you to do?

  • A It encrypts sensitive data using a matrix multiplication algorithm
  • B It allows you to define a matrix of configuration variables that create multiple job runs with different variable combinations ✓ Correct
  • C It defines the sequence in which different workflow jobs must execute relative to each other
  • D It configures load balancing across multiple runners to distribute workflow execution
Explanation

The strategy.matrix feature enables job matrix builds, automatically creating multiple job runs with different combinations of variables (such as different Node.js versions or operating systems), allowing you to test across multiple configurations.

Q60 Hard

What is the purpose of artifact retention policies in GitHub Actions, and how do they impact billing?

  • A They automatically compress artifacts to reduce storage consumption and provide cost savings on all GitHub Actions usage
  • B They control which team members have access to download workflow artifacts and don't impact billing
  • C They determine the network bandwidth consumed during artifact uploads and downloads, which is the primary cost driver for GitHub Actions
  • D They allow you to specify how long artifacts are stored in GitHub, and artifacts consume storage quota which can affect your billing if you exceed free storage limits ✓ Correct
Explanation

Artifact retention policies define how long GitHub stores workflow artifacts before automatic deletion. Artifacts consume GitHub's storage quota, and exceeding the free tier requires additional storage purchases that impact billing.

Ready to test your knowledge?

You've reviewed all 60 questions. Take the interactive practice exam to simulate the real test environment.

▶ Start Practice Exam — Free