Home › Interview questions › CI/CD & GitHub Actions
CI/CD & GitHub Actions Interview Questions & Answers
74 CI/CD & GitHub Actions interview questions in 4 levels — junior to senior, plus 17 production scenarios. Read 3 free answers with real-world analogies.
Free sample answers
What is CI/CD, and why do teams rely on it instead of deploying manually?
One-liner
CI/CD automatically builds, tests, and deploys code changes, replacing slow, error-prone manual steps with a consistent, repeatable process.
Real-world analogy
It's like a restaurant's automated order system that consistently sends every order straight to the right kitchen station, instead of a server manually walking around to shout each order out loud and hoping nothing gets missed or garbled along the way.
Detailed explanation
- CI (Continuous Integration) means automatically building and testing code every time someone pushes a change, catching problems early instead of discovering them much later.
- CD (Continuous Delivery or Deployment) means automatically getting that tested code out to a real environment — either staged for a final manual approval, or deployed directly, depending on your specific setup.
- Without CI/CD, deploying usually means someone manually running a set of steps, which is slow, easy to get wrong, and hard to repeat exactly the same way every single time.
Scenario
A team used to deploy by manually copying files to a server and restarting a few services by hand, and every deployment took an anxious 30 minutes with a real chance of a step being missed. Setting up a CI/CD pipeline that runs the exact same steps automatically on every push cuts deployment time to a few minutes and removes the risk of a forgotten manual step.
Best practices
- Start automating even a small piece of your deployment process — any consistent, repeatable step removes a source of human error.
- Don't wait until a project is 'big enough' to set up CI/CD — it's cheaper and easier to add early than to retrofit later.
- Treat a failing CI check as something to actually fix, not something to routinely ignore or bypass, or the whole safety net starts to lose its value.
How does advanced matrix configuration with include and exclude work?
One-liner
Beyond simply listing basic combinations, include lets you add specific extra combinations (potentially with unique additional variables) to a matrix, and exclude lets you specifically remove particular combinations you don't actually want tested.
Real-world analogy
It's like a basic seating chart that automatically pairs everyone by table and specific seat number, but then adding one specific extra person somewhere unusual (include), while also deliberately removing one specific pairing you know genuinely won't work for some other reason (exclude).
Detailed explanation
- A basic matrix tests every possible combination of your listed variables, but sometimes you don't actually want every single combination — exclude lets you specifically remove particular combinations that either don't make sense or aren't actually necessary to test.
- include lets you add one specific additional combination, and you can even attach a unique extra variable that only applies to that one specific combination, not to the matrix as a whole.
- This flexibility is useful when your actual testing needs aren't a perfectly even, complete grid — like needing to test most combinations, but skip one specific known-incompatible pairing, or add one particular special extra case.
Scenario
A team's matrix tests three different operating systems against two different language versions, but one specific combination is genuinely known to be unsupported and doesn't need to be tested at all. Adding that specific combination to exclude removes it cleanly from the matrix, saving unnecessary time and resources on a run that would have failed anyway for reasons that have nothing meaningfully to do with their actual code.
Best practices
- Use exclude to remove genuinely known-incompatible or unnecessary specific combinations, rather than letting your matrix waste time and resources running combinations you already know aren't relevant.
- Use include to add a genuinely important extra specific case without needing to expand your entire matrix's overall size just to accommodate that one particular scenario.
- Keep your matrix's overall total combination count reasonable — a matrix that's needlessly overly broad slows down your entire workflow considerably for genuinely very little real additional benefit.
A secret you know is configured correctly isn't available inside a workflow run triggered by a pull request from a fork. Why, and how do you handle it?
One-liner
GitHub restricts secrets from being available to workflows triggered by a pull request coming from a fork, as a security measure preventing an untrusted external contributor from potentially exfiltrating your secrets.
Real-world analogy
It's like a company's internal systems automatically refusing to hand over sensitive documents to a workflow triggered by an outside visitor's request, even if that visitor's request otherwise looks completely legitimate, since the company genuinely can't yet fully verify that visitor's actual trustworthiness.
Detailed explanation
- By default, pull_request events from a forked repository don't have access to your repository's secrets, specifically to prevent a malicious external contributor from writing a workflow that exfiltrates them.
- If you genuinely need to run something requiring secrets in response to an external pull request, the pull_request_target event runs in the context of the base repository (with access to secrets), but requires real, careful handling to avoid running untrusted code with that same elevated access.
- A common, safer pattern separates untrusted build and test steps (which don't need secrets) from a separate, more trusted step that only actually runs after a maintainer has manually reviewed and approved the specific pull request.
Scenario
A team's workflow that posts a comment using a secret token fails silently for pull requests coming from external, forked contributors. Understanding that this is actually intentional, deliberate GitHub security behavior (not a bug in their own specific setup), they instead move that particular step into a separate, more carefully designed workflow triggered by pull_request_target, with explicit extra care taken to avoid running any of the actual untrusted, external code with that new step's elevated access.
Best practices
- Understand this restriction as an intentional, deliberate security feature, not a bug, before trying to work around it.
- If you do need pull_request_target for something, be extremely careful to avoid running any actual untrusted external code with that event's elevated access and permissions.
- Consider requiring a maintainer's manual approval before running anything requiring secrets for a pull request from a first-time or otherwise untrusted external contributor.
A preview of the 74 questions in the CI/CD & GitHub Actions guide
Junior (20)
- What is CI/CD, and why do teams rely on it instead of deploying manually?
- What is GitHub Actions, and how does it fit into GitHub as a whole?
- What does a basic GitHub Actions workflow file look like, and where does it actually live?
- What are the different events that can trigger a GitHub Actions workflow, like push and pull_request?
+ 16 more Junior questions, with full answers, in the guide.
Mid-level (20)
- How do you make one job wait for another job to complete using needs, and why would you want to?
- What is a reusable workflow in GitHub Actions, and what problem does it solve?
- What is a composite action, and how is it different from a reusable workflow?
- What are deployment environments in GitHub Actions, and how do environment protection rules work?
+ 16 more Mid-level questions, with full answers, in the guide.
Senior (17)
- How would you design CI/CD architecture and governance for a large organization with many teams and repositories?
- How would you design a strategy for governing and vetting third-party GitHub Actions across an entire organization?
- How would you design an autoscaling self-hosted runner infrastructure to handle variable CI workload at scale?
- How would you design a secrets management strategy for an organization with many repositories and cloud environments?
+ 13 more Senior questions, with full answers, in the guide.
Scenario (17)
- A workflow unexpectedly runs on a branch you didn't intend it to trigger on. How do you investigate and fix it?
- A secret you know is configured correctly isn't available inside a workflow run triggered by a pull request from a fork. Why, and how do you handle it?
- A workflow appears to succeed, but you later discover it deployed using stale, outdated cached dependencies instead of the actual latest ones. How do you investigate and fix it?
- A workflow step fails with a permissions error trying to do something, even though you're confident the necessary permissions were configured. What do you check?
+ 13 more Scenario questions, with full answers, in the guide.
Get the full DevOps / SRE Interview Guide