CICD-106 · Call a local reusable workflow
Encyclopedia · Workflow reuse and caching · All snippets
Previous · CICD-105 · Next · CICD-107
1. Where it fits
- Placement Under the caller's
jobsmap in.github/workflows/ci.yml. - Prerequisites trusted checkout and cache/artifact support verified on the chosen Actions runner.
- Platforms github-actions, gitea-actions.
2. Copy the snippet
yaml
build:
uses: ./.github/workflows/reuse.yml
with:
mode: quick3. How it works
The build job calls the reusable workflow by its repository-relative path and maps the mode input. The provider owns its own jobs and execution steps.
The caller runs a separately declared workflow using a named input.
flowchart TD N1["Caller job"] N2["Reusable workflow"] N1 --> N2 N3["Mode input"] N3 --> N2 N4["Provider jobs"] N2 --> N4 N5["Caller outcome"] N4 --> N5 classDef trigger fill:#EFF6FF,stroke:#0540F2,color:#0A0A0A classDef build fill:#CCFBF1,stroke:#0D9488,color:#0A0A0A classDef test fill:#EEF2FF,stroke:#4F46E5,color:#0A0A0A classDef gate fill:#FEF3C7,stroke:#D97706,color:#0A0A0A classDef security fill:#EDE9FE,stroke:#7C3AED,color:#0A0A0A classDef deploy fill:#D1FAE5,stroke:#059669,color:#0A0A0A classDef fail fill:#FEE2E2,stroke:#DC2626,color:#0A0A0A class N1,N3 trigger class N2 build class N4 test class N5 gate
4. Verify the result
Put this in jobs and define workflow_call with a string input in the provider.
Validation syntax-validated (YAML parse). Status definitions.