Skip to content
Latchkey

How to Create a Composite Action in GitHub Actions

A composite action packages multiple steps behind a single uses reference you can share across repos.

Create an action.yml with runs.using: composite and a steps: list. Call it from any workflow with uses: pointing at the action path.

Steps

  • Create action.yml in a folder (e.g. .github/actions/setup).
  • Set runs.using: composite and list steps:.
  • Declare inputs: and reference them as ${{ inputs.<name> }}.

action.yml

.github/actions/setup/action.yml
name: 'Setup project'
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

Gotchas

  • Every run: step in a composite action must declare a shell:.
  • Reference the action with uses: ./.github/actions/setup from a workflow.

Related guides

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