A team wants to share "checkout, setup Java, Maven cache, run Sonar" steps. Reusable workflow or composite action?
BeginnerScenarioReuse at Scale: Reusable Workflows & Actions
Answer
Situation read → A sequence of steps that should run inside the consumer's job.
What I'd do →
- Composite action in
platform-actions/java-setup/action.yml, inputsjava-versionandsonar-token. - Consumers add it as one step and keep their own job settings and runner choice.
Why → No need for separate runners, environments or permissions; a composite is lighter and composes with the consumer's other steps.
Interview tip → Note the composite cannot read secrets directly, so the Sonar token is an input.
More on Reuse at Scale: Reusable Workflows & Actions
Forty microservice repos each have a slightly different copy of the same build workflow. How do you standardize?IntermediateA shared reusable workflow change broke 120 pipelines on Monday. How do you prevent a repeat?IntermediateA called reusable workflow needs a Sonar token, an npm token and AWS access. How do you pass them?AdvancedYou want to ensure only the central deploy workflow can assume the production AWS role, not arbitrary workflows in app repos. How?AdvancedYou need an action that comments a Terraform plan summary on PRs and must work on Linux and Windows. Which kind?BeginnerA reusable workflow needs to return the deployed URL to the caller. How?Beginner