Skip to content
L
LearnCoachAssist
Topics
AI
AI Agents (500 Questions)
AI Math (500 Questions)
AI Math Beginner
AI Search Results
Claude Code Prompts
Art & Design
Art History
Color Theory
Graphic Design Principles
Knitting And Crochet
Photography Exposure Triangle And Composition
Business
Accounting Basics
Customer Research
Economics
Excel Formulas For Financial Analysts
Go To Market Strategy
Browse all topics →
Packs
Featured Packs
Python Programming Essentials
Prompt Engineering
Prompting Claude Code
AI Agents and Autonomous Systems
SQL and Database Fundamentals
JavaScript Fundamentals
Algorithms and Data Structures
Git and Version Control
Browse all packs →
Learn
Learning Paths
AI Deck Generator
How it works
Quiz
Blog
Cheat Sheets
Pricing
Resources
Pricing
Compare
FAQ
About
Contact
Effective Studying Guide
Free Anki Decks
Log in
Start Free
Topics
AI
AI Agents (500 Questions)
AI Math (500 Questions)
AI Math Beginner
AI Search Results
Claude Code Prompts
Art & Design
Art History
Color Theory
Graphic Design Principles
Knitting And Crochet
Photography Exposure Triangle And Composition
Business
Accounting Basics
Customer Research
Economics
Excel Formulas For Financial Analysts
Go To Market Strategy
Browse all topics →
Packs
Python Programming Essentials
Prompt Engineering
Prompting Claude Code
AI Agents and Autonomous Systems
SQL and Database Fundamentals
JavaScript Fundamentals
Algorithms and Data Structures
Git and Version Control
Browse all packs →
Learn
Learning Paths
AI Deck Generator
How it works
Quiz
Blog
Cheat Sheets
Pricing
Resources
Pricing
Compare
FAQ
About
Contact
Effective Studying Guide
Free Anki Decks
Start Free
Log in
← Quit
GitHub Actions CI/CD Recipes Practice Exam
Question
1
of
50
60:00
Question 1
GitHub Actions CI/CD Recipes
What is the maximum workflow run time for self-hosted runners?
Use env: at the top level of the workflow, under on: and above jobs:.
Configurable; no fixed limit like GitHub-hosted runners, but jobs are killed if the runner goes offline.
A CI/CD and workflow automation platform built into GitHub that runs jobs in response to repository events using YAML-defined workflows stored in .github/workflows/.
A unique number for the current workflow run.
Question 2
GitHub Actions CI/CD Recipes
What is the purpose of hashFiles() in cache keys?
Up to 2,000 jobs per workflow run across all matrix combinations.
read-only on most scopes; needs to be elevated explicitly when writing back.
Allows a workflow to be triggered manually from the Actions tab, the REST API, or the CLI.
Generates a hash of the listed file patterns so the cache invalidates when those files change.
Question 3
GitHub Actions CI/CD Recipes
What does ${{ runner.arch }} return?
Use ${{ matrix.node-version }} in run scripts or action inputs.
The architecture of the runner, e.g., X64, ARM64.
actions/setup-node@v4 with: node-version: '20.x' or '20.10.0'.
Runs a job multiple times in parallel with different variable combinations, defined under jobs.
.strategy.matrix.
Question 4
GitHub Actions CI/CD Recipes
What does ${{ github.actor }} return?
The login of the user or app that initiated the workflow run.
Checks out your repository onto the runner so subsequent steps can access the code.
Use env: at the top level of the workflow, under on: and above jobs:.
Allows a workflow to be triggered manually from the Actions tab, the REST API, or the CLI.
Question 5
GitHub Actions CI/CD Recipes
What is the events: pull_request_target trigger best practice?
Use with extreme caution: it runs in the base repo context with write permissions and is a common source of script injection attacks.
A rule that gates deployments to an environment, e.g., requiring manual approval or waiting for a status check.
Use env: KEY: value under the step, or env: in run: like FOO=bar command.
services: postgres: image: postgres:16 env: POSTGRES_PASSWORD: postgres ports: ['5432:5432']
Question 6
GitHub Actions CI/CD Recipes
How do you set up a Java environment?
The number of the pull request that triggered the workflow.
Use strategy.matrix.include to append named combinations alongside generated ones.
Use actions/setup-java@v4 with distribution: 'temurin' and java-version: '21'.
Define on.workflow_call.inputs and reference them in the caller via uses: with: input_name: value.
Question 7
GitHub Actions CI/CD Recipes
Give an example matrix with two Node versions.
An automated, configurable process defined by a YAML file that runs one or more jobs and is triggered by events.
strategy: matrix: node-version: [18, 20]
Up to 2,000 jobs per workflow run across all matrix combinations.
on: pull_request: branches: [main, develop]
Question 8
GitHub Actions CI/CD Recipes
What is the difference between an action and a reusable workflow?
The on: workflow_call: event that lets a workflow be invoked by other workflows as a reusable job.
Actions are reusable units within a step; reusable workflows are whole workflows invoked as a job.
Up to 2,000 jobs per workflow run across all matrix combinations.
Set strategy.fail-fast: false to keep all combinations running, or true (default) to cancel on first failure.
Question 9
GitHub Actions CI/CD Recipes
How do you skip workflow runs based on commit message?
permissions: contents: write at job level overrides broader workflow settings.
Runs a job multiple times in parallel with different variable combinations, defined under jobs.
.strategy.matrix.
Add a step with if: "! contains(github.event.head_commit.message, '[skip ci]')" or use the docs-recommended skip patterns.
A workflow that runs on push to main builds the artifact, then a job with environment: production deploys after manual approval.
Question 10
GitHub Actions CI/CD Recipes
How do you write a step that runs only on pull_request events?
Runs only when the workflow was cancelled (e.g., by a new push or manual cancel).
Add if: github.event_name == 'pull_request' to the step.
Follow Settings -> Actions -> Runners -> New self-hosted runner steps in the repository or org settings.
Use env: KEY: value under the step, or env: in run: like FOO=bar command.
Question 11
GitHub Actions CI/CD Recipes
What is a step in GitHub Actions?
The repository root (GITHUB_WORKSPACE), unless overridden by working-directory:.
GitHub-hosted runners (managed by GitHub) and self-hosted runners (you manage).
An individual task within a job, either a shell command (run:) or an invocation of an action (uses:).
Add a step with if: "! contains(github.event.head_commit.message, '[skip ci]')" or use the docs-recommended skip patterns.
Question 12
GitHub Actions CI/CD Recipes
What is a runner in GitHub Actions?
The server that executes a workflow job; can be GitHub-hosted (Ubuntu, Windows, macOS) or self-hosted.
Caches the user's npm, yarn, or pnpm store based on lockfile hashes.
An individual task within a job, either a shell command (run:) or an invocation of an action (uses:).
github-actions[bot]
Question 13
GitHub Actions CI/CD Recipes
What is a workflow in GitHub Actions?
Use sudo apt-get update && sudo apt-get install -y
in a run step.
Up to 10 GB total per workflow run across all artifacts.
An automated, configurable process defined by a YAML file that runs one or more jobs and is triggered by events.
Use on: release: types: [published] and deploy in a job with environment: production.
Question 14
GitHub Actions CI/CD Recipes
What is the recommended user email for bot commits?
Use actions/upload-artifact@v4 with a name: and path: to store files for later download.
Use env: KEY: value under the step, or env: in run: like FOO=bar command.
The on: workflow_call: event that lets a workflow be invoked by other workflows as a reusable job.
41898282+github-actions[bot]@users.noreply.github.com
Question 15
GitHub Actions CI/CD Recipes
What is a common way to use Actions for deployments?
A workflow that runs on push to main builds the artifact, then a job with environment: production deploys after manual approval.
Up to 2,000 jobs per workflow run across all matrix combinations.
An automated, configurable process defined by a YAML file that runs one or more jobs and is triggered by events.
strategy: matrix: node-version: [18, 20]
Question 16
GitHub Actions CI/CD Recipes
What is the default branch filter for push and pull_request triggers?
push runs on all branches by default; pull_request runs on all branches by default unless branches/paths filters are set.
Runs the step/job only when all previous steps/jobs in the dependency chain succeeded.
A mechanism that cancels or queues in-progress runs of the same workflow to prevent overlapping executions.
A unique number for the current workflow run.
Question 17
GitHub Actions CI/CD Recipes
What is the maximum number of jobs that can run in a workflow?
Add defaults.run.shell at the job level.
Caches dependencies between workflow runs to speed up builds, keyed by paths and a key.
360 minutes (6 hours) for GitHub-hosted runners.
Up to 2,000 jobs per workflow run across all matrix combinations.
Question 18
GitHub Actions CI/CD Recipes
What is the difference between uses: at job level and step level?
Spins up additional service containers (e.g., databases) that the job can connect to via localhost and a port.
Use with extreme caution: it runs in the base repo context with write permissions and is a common source of script injection attacks.
${{ needs.job_id.outputs.output_name }} — outputs must be declared under jobs.
.outputs.
Job-level uses: invokes a reusable workflow; step-level uses: invokes an action.
Question 19
GitHub Actions CI/CD Recipes
How do you set the default shell for all steps in a job?
Use actions/download-artifact@v4 with name: and path:.
The name of the workflow.
Add defaults.run.shell at the job level.
41898282+github-actions[bot]@users.noreply.github.com
Question 20
GitHub Actions CI/CD Recipes
What does if: success() mean on a job or step?
Runs the step/job only when all previous steps/jobs in the dependency chain succeeded.
Use ${{ runner.os }} which is Linux, Windows, or macOS.
${{ steps.step_id.outputs.output_name }}
Use env: KEY: value under the step, or env: in run: like FOO=bar command.
Question 21
GitHub Actions CI/CD Recipes
What does the cache option in actions/setup-node do?
actions/setup-node@v4 with: node-version: '20.x' or '20.10.0'.
Caches the user's npm, yarn, or pnpm store based on lockfile hashes.
runs-on: self-hosted (or runs-on: [self-hosted, linux, x64] for a specific label).
v4 is a stable major tag/branch; @main tracks the latest commit on the main branch and is less stable.
Question 22
GitHub Actions CI/CD Recipes
What is a deployment protection rule?
Only after the named needs job completes successfully.
A rule that gates deployments to an environment, e.g., requiring manual approval or waiting for a status check.
Add options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=5 to the service command.
The branch or tag ref that triggered the workflow run, e.g., refs/heads/main.
Question 23
GitHub Actions CI/CD Recipes
What is the actions/setup-node cache: 'npm' example pattern?
.yaml or .yml, stored under .github/workflows/ in the repository.
v4 is a stable major tag/branch; @main tracks the latest commit on the main branch and is less stable.
actions/setup-node@v4 with: node-version: 20 cache: 'npm' — built-in dependency caching.
360 minutes (6 hours) for GitHub-hosted runners.
Question 24
GitHub Actions CI/CD Recipes
Which value is used for the latest stable Ubuntu runner?
Add defaults.run.shell at the job level.
ubuntu-latest
Up to 2,000 jobs per workflow run across all matrix combinations.
Allows a workflow to be triggered manually from the Actions tab, the REST API, or the CLI.
Question 25
GitHub Actions CI/CD Recipes
What is the default artifact retention period?
Require manual approval before workflows run, configured in Settings -> Actions -> General.
90 days for repository artifacts, after which they are deleted.
on: pull_request: branches: [main, develop]
Add options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=5 to the service command.
Question 26
GitHub Actions CI/CD Recipes
What does the GITHUB_TOKEN environment variable provide?
A token automatically provisioned for the workflow, used to authenticate with the GitHub API.
Use ${{ matrix.node-version }} in run scripts or action inputs.
on: schedule: - cron: '30 2 * * *'
The repository root (GITHUB_WORKSPACE), unless overridden by working-directory:.
Question 27
GitHub Actions CI/CD Recipes
How do you install Python on ubuntu-latest without setup-python?
Add a step with if: "! contains(github.event.head_commit.message, '[skip ci]')" or use the docs-recommended skip patterns.
Groups runs by workflow and ref so duplicate runs on the same branch cancel the latest only.
Use actions/setup-python@v5 with python-version: '3.12'.
actions/setup-node@v4 with: node-version: 20 cache: 'npm' — built-in dependency caching.
Question 28
GitHub Actions CI/CD Recipes
How do you set up a PostgreSQL service with health checks?
10 GB per artifact (larger files require GitHub Packages or external storage).
An individual task within a job, either a shell command (run:) or an invocation of an action (uses:).
Grants read-only access to all available scopes for GITHUB_TOKEN.
Add options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=5 to the service command.
Question 29
GitHub Actions CI/CD Recipes
How do you register a self-hosted runner?
Generates a hash of the listed file patterns so the cache invalidates when those files change.
Follow Settings -> Actions -> Runners -> New self-hosted runner steps in the repository or org settings.
The on: workflow_call: event that lets a workflow be invoked by other workflows as a reusable job.
90 days for repository artifacts, after which they are deleted.
Question 30
GitHub Actions CI/CD Recipes
What is a composite action?
The server that executes a workflow job; can be GitHub-hosted (Ubuntu, Windows, macOS) or self-hosted.
uses: actions/cache@v4 with: path: ~/.npm key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}.
An action defined by a YAML file with runs.using: composite, allowing multiple steps to be bundled and reused.
permissions: contents: write at job level overrides broader workflow settings.
Question 31
GitHub Actions CI/CD Recipes
How do you reference a job output in another job?
Define on.workflow_call.inputs and reference them in the caller via uses: with: input_name: value.
The on: workflow_call: event that lets a workflow be invoked by other workflows as a reusable job.
${{ needs.job_id.outputs.output_name }} — outputs must be declared under jobs.
.outputs.
A number that increments for each run of the workflow in the repository.
Question 32
GitHub Actions CI/CD Recipes
What is the difference between key and restore-keys?
Add needs: job_id to a job to declare it depends on another job's success.
Follow Settings -> Actions -> Runners -> New self-hosted runner steps in the repository or org settings.
Use a pipe | block under run: or a heredoc inside the script.
key is the exact match for upload and download; restore-keys are prefix matches used as fallback when the exact key is missing.
Question 33
GitHub Actions CI/CD Recipes
How do you pass inputs to an action?
A number that increments for each run of the workflow in the repository.
Use the with: key, e.g. with: node-version: 20.
on: schedule: - cron: '30 2 * * *'
Add shell: pwsh, shell: sh, shell: python, etc.
Question 34
GitHub Actions CI/CD Recipes
What are the two categories of runners GitHub provides by default?
Use actions/setup-python@v5 with python-version: '3.12'.
The server that executes a workflow job; can be GitHub-hosted (Ubuntu, Windows, macOS) or self-hosted.
GitHub-hosted runners (managed by GitHub) and self-hosted runners (you manage).
41898282+github-actions[bot]@users.noreply.github.com
Question 35
GitHub Actions CI/CD Recipes
What is the recommended user name for bot commits?
github-actions[bot]
Use the with: key, e.g. with: node-version: 20.
push, pull_request, and workflow_dispatch are common triggers.
Runs the step/job only when a previous step/job in the dependency chain failed.
Question 36
GitHub Actions CI/CD Recipes
How do you set permissions for a workflow or job?
Generates a hash of the listed file patterns so the cache invalidates when those files change.
Use the permissions: key, e.g. permissions: contents: read or permissions: write-all.
Use pull_request_target with explicit branch filtering, or enable Require approval for first-time contributors.
Use ${{ matrix.node-version }} in run scripts or action inputs.
Question 37
GitHub Actions CI/CD Recipes
What shell does run: default to on Linux runners?
Up to 10 GB total per workflow run across all artifacts.
bash
A mechanism that cancels or queues in-progress runs of the same workflow to prevent overlapping executions.
41898282+github-actions[bot]@users.noreply.github.com
Question 38
GitHub Actions CI/CD Recipes
What does ${{ github.sha }} return?
An action defined by a YAML file with runs.using: composite, allowing multiple steps to be bundled and reused.
Excludes commits that modify files matching the listed patterns from triggering the workflow.
Define on.workflow_call.inputs and reference them in the caller via uses: with: input_name: value.
The commit SHA that triggered the workflow run.
Question 39
GitHub Actions CI/CD Recipes
Give an example of caching npm dependencies.
The architecture of the runner, e.g., X64, ARM64.
Caches the user's npm, yarn, or pnpm store based on lockfile hashes.
The name of the workflow.
uses: actions/cache@v4 with: path: ~/.npm key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}.
Question 40
GitHub Actions CI/CD Recipes
What does ${{ github.run_number }} return?
A number that increments for each run of the workflow in the repository.
uses: actions/cache@v4 with: path: ~/.npm key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}.
runs-on: self-hosted (or runs-on: [self-hosted, linux, x64] for a specific label).
actions/setup-node@v4 with: node-version: '20.x' or '20.10.0'.
Question 41
GitHub Actions CI/CD Recipes
What does actions/checkout@v4 do?
The commit SHA that triggered the workflow run.
Checks out your repository onto the runner so subsequent steps can access the code.
Add defaults.run.shell at the job level.
256 in a single matrix axis; total combinations must be reasonable (workflow job cap applies).
Question 42
GitHub Actions CI/CD Recipes
What matrix strategy allows?
ubuntu-latest
push, pull_request, and workflow_dispatch are common triggers.
Use ${{ matrix.node-version }} in run scripts or action inputs.
Runs a job multiple times in parallel with different variable combinations, defined under jobs.
.strategy.matrix.
Question 43
GitHub Actions CI/CD Recipes
What does services: in a job do?
Spins up additional service containers (e.g., databases) that the job can connect to via localhost and a port.
360 minutes for GitHub-hosted runners.
.yaml or .yml, stored under .github/workflows/ in the repository.
Up to 10 GB total per workflow run across all artifacts.
Question 44
GitHub Actions CI/CD Recipes
What is a reusable workflow?
Limits the trigger to commits that change files matching the given glob patterns.
A workflow referenced by another workflow using uses: owner/repo/.github/workflows/file.yml@ref, enabling shared pipelines.
Use actions/download-artifact@v4 with name: and path:.
Use env: at the top level of the workflow, under on: and above jobs:.
Question 45
GitHub Actions CI/CD Recipes
How do you add an extra matrix entry to an existing one?
uses: actions/cache@v4 with: path: ~/.npm key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}.
Use strategy.matrix.include to append named combinations alongside generated ones.
Excludes commits that modify files matching the listed patterns from triggering the workflow.
Checks out your repository onto the runner so subsequent steps can access the code.
Question 46
GitHub Actions CI/CD Recipes
What does ${{ github.workflow }} return?
A workflow referenced by another workflow using uses: owner/repo/.github/workflows/file.yml@ref, enabling shared pipelines.
Egress is open to the public internet by default; you must use a self-hosted runner for private networking.
Actions are reusable units within a step; reusable workflows are whole workflows invoked as a job.
The name of the workflow.
Question 47
GitHub Actions CI/CD Recipes
Give an example of starting a PostgreSQL service.
The server that executes a workflow job; can be GitHub-hosted (Ubuntu, Windows, macOS) or self-hosted.
services: postgres: image: postgres:16 env: POSTGRES_PASSWORD: postgres ports: ['5432:5432']
The login of the user or app that initiated the workflow run.
Set permissions: contents: write and use it as the git auth, e.g. git config user.name "github-actions[bot]".
Question 48
GitHub Actions CI/CD Recipes
How do you upload build artifacts in a workflow?
Use actions/upload-artifact@v4 with a name: and path: to store files for later download.
${{ steps.step_id.outputs.output_name }}
Limits the trigger to commits that change files matching the given glob patterns.
Use ${{ matrix.node-version }} in run scripts or action inputs.
Question 49
GitHub Actions CI/CD Recipes
How do you reference the runner operating system in a step?
Use ${{ runner.os }} which is Linux, Windows, or macOS.
Only after the named needs job completes successfully.
The default working directory on the runner, e.g., /home/runner/work/repo/repo.
Runs regardless of success or failure of previous steps/jobs.
Question 50
GitHub Actions CI/CD Recipes
How do you set an environment variable for all steps in a job?
Use env: at the top level of the workflow, under on: and above jobs:.
Egress is open to the public internet by default; you must use a self-hosted runner for private networking.
Add env: at the job level.
GitHub-hosted runners (managed by GitHub) and self-hosted runners (you manage).
Question navigator
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
← Previous
Next →
✅ Submit Exam