How to Call a Reusable Workflow From Another Repository in GitHub Actions
A cross-repo call uses the full owner/repo/.github/workflows/file.yml@ref path, so one repo can host shared pipelines.
Point uses: at the workflow in another repository. Access to private source repos is controlled by the repo's Actions settings for who may call its workflows.
Steps
- Host the reusable workflow in a central repo (e.g.
my-org/ci). - In each consumer, set
uses: my-org/ci/.github/workflows/build.yml@ref. - For private central repos, allow access under Settings to Actions to Access.
Caller workflow
.github/workflows/ci.yml
jobs:
build:
uses: my-org/ci/.github/workflows/build.yml@v1
with:
environment: staging
secrets: inheritGotchas
- The
@refis required for cross-repo calls; a bare path is not allowed. - A private central repo must explicitly grant access to the calling repositories.
Related guides
How to Pin a Reusable Workflow by Tag or SHA in GitHub ActionsVersion a reusable GitHub Actions workflow by pinning the caller @ref to a tag, branch, or full commit SHA, t…
How to Share Actions and Workflows Across an Org in GitHub ActionsCentralize reusable GitHub Actions workflows and actions in one org repository and grant access under Actions…