What is a reusable workflow in GitHub Actions and how is it different from a composite action?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Here's the key distinction: a reusable workflow is a whole workflow (with jobs and runners) called from another workflow using 'uses'. A composite action is a single step — it slots into a job's step list. Different scope levels.
Full explanation below image
Full Explanation
Reusable workflows and composite actions both enable code reuse in GitHub Actions but at different levels: (1) Reusable Workflows — complete workflow files (containing jobs, runner specifications, and steps) stored in .github/workflows/ and called from other workflows using the 'uses' keyword at the job level. They run as separate workflow jobs with their own runners. (2) Composite Actions — defined in action.yml files, they bundle multiple steps into a single action that's referenced in a workflow step using 'uses'. They run within the calling job's runner context. Key difference: reusable workflows are job-level abstractions (they spin up runners); composite actions are step-level abstractions (they execute within an existing runner). Both promote DRY (Don't Repeat Yourself) principles in CI/CD.