CI/CD & GitHub Actions (50 Qs)•Part 3: Enterprise Scale, Compliance & Production Hardening (Senior / Staff)
GitHub Actions Reusable Workflows vs Composite Actions: Key differences and selection criteria.
senior LevelCode ExampleState ManagementCI/CD & DevOps
In Simple Words:
- Reusable Workflows (
workflow_call): Entire parameterized pipeline workflows defined in.github/workflows/. They run on their own separate runners, support secret inheritance, environment protection gates, and multi-job execution. - Composite Actions (
action.yml): Bundles multiple shell steps into a single reusable action within the same job/runner. Best for packaging frequently repeated tasks (e.g., setup toolchain + authenticate + cache).
| Feature | Reusable Workflows (workflow_call) | Composite Actions (action.yml) |
|---|---|---|
| Scope | Cross-job orchestration (contains multiple jobs) | Step-level (runs within an existing job) |
| Runner | Can define new and independent runs-on targets | Executes inside the caller job's runner |
| Secrets Access | Explicit input or secrets: inherit | Inputs passed as standard arguments |
| File Location | .github/workflows/*.yml | Root or subfolder containing action.yml |
yaml
# Reusable Workflow Caller
jobs:
call-deploy:
uses: my-org/shared-workflows/.github/workflows/deploy.yml@v2
with:
environment: production
secrets: inherit