GitHub Actions Fundamentals interview question
Reusable workflows or composite actions: what's the difference, and when do you use each?
Comparison Asked in DevOps Engineer interviews
Summary
A composite action bundles steps into one step you can uses: inside a job; it runs on the caller's runner.
A reusable workflow (on: workflow_call) is a whole workflow with its own jobs, runners, environments and
secrets that another workflow calls as a job. Use composite actions for shared step sequences, reusable
workflows for standard pipelines teams should follow.
Keep reading with a membership
The full answer with examples, key points and comparisons is part of the membership, along with every other interview answer, progress tracking and Daily Review. Most-asked answers stay free to read.
More GitHub Actions Fundamentals questions
- Explain how a GitHub Actions workflow is structured: events, jobs, steps, runners and actions.
- How do you keep secrets safe in GitHub Actions, and why use OIDC to reach the cloud?
- Write a GitHub Actions workflow that tests, builds and pushes a Docker image, and deploys only from main.
- How do you speed up slow GitHub Actions workflows?
- How do you add approval gates to deployments in GitHub Actions?
- Why should you pin third-party actions to a commit SHA?
- What are the security risks of pull_request_target and self-hosted runners?
- How does the GITHUB_TOKEN work, and how do you limit its permissions?