Skip to content
Latchkey

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.yml in 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: bash

Using 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 @ref to a tag or SHA so upstream edits do not change consumer builds unexpectedly.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →