What are 'GitHub Actions composite actions' and when should they be used over reusable workflows?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Composite actions are step-level reuse; reusable workflows are job-level reuse. Use composite actions when you want to bundle a sequence of shell commands and tool calls that run in the same runner environment as the calling job. Use reusable workflows when you need entire job structures with their own runners and environments.
Full explanation below image
Full Explanation
Composite actions and reusable workflows both enable code reuse in GitHub Actions, but at different granularities: (1) Composite actions — defined in action.yml with 'using: composite'. Contain multiple steps (run, uses). Called within a job using 'uses:' in a step. Run in the SAME runner environment as the calling job (share env vars, working directory). Best for: grouping 3-5 related steps, sharing utility functions, reusing installation sequences. (2) Reusable workflows — defined as full workflow files with 'workflow_call' trigger. Define complete jobs with 'runs-on'. Called at the job level. Run in a NEW runner environment. Can have their own environments and secrets. Best for: multi-job test suites, complete deployment patterns, cross-repository CI standards. Key distinction: composite actions are step-level; reusable workflows are job-level.