Skip to main content
A composite action in GitHub Actions bundles multiple steps into a single, reusable action. This guide shows how to create a simple composite action in the same repository, call it from a workflow, run it, and troubleshoot common issues.

What you’ll build

  • A local composite action defined in composite-action/action.yaml
  • A workflow that calls the composite action using a local path (./composite-action)
  • Example run output and troubleshooting tips

Prerequisites

  • A GitHub repository with a .github/workflows/ folder
  • Basic familiarity with GitHub Actions workflows and YAML

Create the composite action

  1. In the root of your repository create a folder named composite-action.
  2. Inside that folder create an action.yaml file with this content:
Key points:
  • inputs.environment is declared as required — callers must provide this input.
  • runs.using: "composite" marks the action as a composite action composed of multiple steps.
  • The steps array defines the shell commands that execute when the action is invoked.

Composite action fields at a glance

Use the composite action in a workflow

Create a workflow file (for example .github/workflows/ci-2.yml) that calls the local composite action:
Notes:
  • Use a local path (./composite-action) for actions defined in the same repository.
  • Pass required inputs with the with block.
Including [skip ci] in your commit message prevents workflows from being triggered by that commit. This is useful when you want to test a specific workflow from the Actions UI using “Run workflow” without running all workflows on push.

Running the workflow and troubleshooting

When you run the workflow (push or use “Run workflow”), the runner will:
  1. Check out the repository.
  2. Look for the composite action at the specified relative path.
  3. Execute the steps defined in action.yaml.
If GitHub cannot find the action, you’ll see an error like: “Unable to find action … in this repository. The repository may not contain an action defined by action.yml, action.yaml, or Dockerfile.” Common causes and fixes:
  • Typo in the uses path (e.g., ./composite-actions vs ./composite-action) — correct the path and commit again.
  • action.yaml missing or incorrectly named — ensure the file exists and is named action.yml or action.yaml.
  • Incorrect repository structure — verify that composite-action/action.yaml is at the repository root.
A dark-themed GitHub Actions run page for "Using Composite Workflow #1" (ci-2.yml) showing a queued job "test-composite-action" triggered by user alice-admin. The run status is "Queued" and a "Cancel workflow" button is visible.
If the workflow reports “Unable to find action …”, double-check the uses path and the file name. Composite actions must be defined with an action.yml or action.yaml (or a Dockerfile for container actions) at the path you reference.

Example run output

Successful run output for the composite action looks like:

Summary

  • Define a composite action with runs.using: "composite" and list its steps in action.yaml.
  • Call local composite actions using a relative path like ./composite-action and supply required inputs with with.
  • If GitHub cannot find your action, verify the uses path, file name (action.yml or action.yaml), and repository structure.

Watch Video