How to Call a Reusable Workflow in GitHub Actions
You call a reusable workflow by setting uses: directly on a job, not on a step.
In the caller, define a job whose uses: points at the reusable workflow path plus a @ref. The job has no runs-on or steps; the called workflow supplies those.
Steps
- Add a job in the caller workflow.
- Set
uses: owner/repo/.github/workflows/build.yml@refon that job. - Do not add
runs-onorsteps; the reusable workflow owns them.
Caller workflow
.github/workflows/ci.yml
on: [push]
jobs:
build:
uses: my-org/ci/.github/workflows/build.yml@main
test:
needs: build
uses: my-org/ci/.github/workflows/test.yml@mainGotchas
- A calling job cannot mix
uses:with its ownsteps:; keep the two styles separate. - You can chain reusable-workflow jobs with
needs:just like normal jobs.
Related guides
How to Create a Reusable Workflow in GitHub ActionsTurn a workflow into a callable unit in GitHub Actions by adding on.workflow_call, so other workflows can inv…
How to Pass Inputs to a Reusable Workflow in GitHub ActionsSend typed values into a reusable GitHub Actions workflow by declaring workflow_call.inputs and supplying the…