Video Thumbnail for Lesson
6.2: Composite Actions

Composite actions: share step sequences

A composite action is simply an action.yaml that declares optional inputs and outputs alongside the steps to run. Because the steps execute in the runner directly, this is the lightest-weight way to package shell-based logic.

Documentation: https://docs.github.com/en/actions/tutorials/create-actions/create-a-composite-action

name: 'Hello World'
description: 'Greet someone'
inputs:
  who-to-greet: # id of input
    description: 'Who to greet'
    required: true
    default: 'World'

runs:
  using: 'composite'
  steps:
    - name: Set Greeting
      run: echo "Hello $INPUT_WHO_TO_GREET."
      shell: bash
      env:
        INPUT_WHO_TO_GREET: ${{ inputs.who-to-greet }}

To consume the action you reference it with a relative uses: path and make sure to checkout the repository so that action.yaml is present on the runner:

jobs:
  hello-world:
    runs-on: ubuntu-24.04
    name: Usage of the composite action
    steps:
      - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
      - id: composite-action-instance
        uses: ./06-authoring-actions/composite-action
        with:
          who-to-greet: "from composite action in hello-world-1!"

Tip: In larger projects it is common to store first party actions under .github/actions/<action-name> so other contributors know where to find them.