How to Share Composite Actions From a Dedicated Repo
A dedicated actions repo holds composite actions that any workflow references with uses owner/actions/path@ref, versioned like any other dependency.
Store each composite action in actions/<name>/action.yml in a central repo. Consuming workflows reference it with uses: my-org/actions/<name>@ref, pinning to a tag or SHA.
Steps
- Create
actions/setup/action.ymlin a central actions repo. - Tag releases of the actions repo (for example
v1). - Reference it from any workflow with
uses: my-org/actions/setup@v1.
Composite action in the central repo
actions/setup/action.yml
name: 'Org setup'
inputs:
node-version:
default: '20'
runs:
using: composite
steps:
- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
- run: npm ci
shell: bashUsing it from another repo
.github/workflows/ci.yml
steps:
- uses: actions/checkout@v4
- uses: my-org/actions/setup@v1
with:
node-version: '20'Gotchas
- If the actions repo is private, consuming repos must be allowed to use it under Actions settings.
- Pin
@refto a tag or SHA so upstream edits do not change consumer builds unexpectedly.
Related guides
How to Share a Reusable Workflow From a Central RepoKeep one canonical CI workflow in a central repository and call it from every other repo with uses and workfl…
How to Check Out Private Repos With a GitHub App TokenGenerate a short-lived GitHub App installation token scoped to specific repos and use it with actions/checkou…