A single monorepo workflow is 600 lines. How do you organize it?
IntermediateScenarioGitHub Actions
Answer
Situation read → Workflow sprawl.
What I'd do →
- Split per domain (
api.yml,web.yml) with path filters. - Extract reusable workflows (
workflow_call) for build/deploy, and composite actions for setup. - Keep matrix and conditionals readable; YAML anchors are now supported in workflow files, but use them sparingly because they hide the effective job definition.
Why → Reusable workflows and composite actions give versioned, testable reuse, while anchors only deduplicate text inside one file.
Interview tip → Reuse across files needs reusable workflows or composite actions, not anchors.
More on GitHub Actions
What are workflows, jobs, steps and actions in GitHub Actions?BeginnerWhat events can trigger a workflow?BeginnerWhat is the difference between `pull_request` and `pull_request_target`?AdvancedWhat is a runner, and how do GitHub-hosted and self-hosted runners differ?BeginnerHow do you pass data between steps and between jobs?IntermediateHow does a build matrix work?Intermediate