Skip to main content
A composite action in GitHub Actions groups multiple steps into a single, reusable action. This is useful for encapsulating common setup, linting, or test sequences and reusing them across workflows in the same repository. In this guide you’ll learn how to:
  • Create a composite action (action.yaml) in your repo.
  • Call that composite action from a workflow with uses: ./....
  • Troubleshoot the common “could not find action.yaml” error.
  • Run a single workflow manually (useful when testing).

1. Create a composite action

  1. At the root of your repository create a folder named composite-action.
  2. Inside that folder add an action.yaml file with the following contents:
Explanation:
  • inputs.environment is declared as required so callers must provide a value.
  • runs.using: "composite" tells GitHub this action is a composite action, composed of the listed steps.
  • Replace the sample echo steps with real tasks (install dependencies, run linters, run tests, etc.) as appropriate for your project.
Quick file reference:

2. Use the composite action in a workflow

Create a workflow file at .github/workflows/ci2.yaml (or another name you prefer). This example checks out the repository, then invokes the composite action from the local ./composite-action directory:
Notes:
  • When referencing a composite action stored in the same repository, use a relative path such as uses: ./composite-action.
  • Provide the with: map to pass required inputs (here, environment).
Ensure the path you use in uses: ./... exactly matches the directory name in the repository. A small typo in the folder name will cause the runner to fail to locate the action.

3. When committing

If you want to avoid triggering other workflows while testing this new workflow, include [skip ci] or [ci skip] in your commit message. This prevents CI from running all workflows on that commit.
A dark-themed GitHub repository page showing the .github file tree on the left and a centered "Commit changes" dialog with the commit message set to "[skip ci]". The right column displays the Actions/Marketplace panel.

Run a single workflow manually

If you committed with [skip ci] but still want to run only the workflow you just created, open the Actions tab in the GitHub UI, select your workflow (Using Composite Workflow), and click the “Run workflow” button. This option is available for workflows that define workflow_dispatch in the on: block and will run only that workflow on-demand.

4. Troubleshooting

If your workflow fails with an error like: “could not find action.yaml or action.yml or Dockerfile”, check the following:
  • The folder name used in your workflow matches the actual folder name in the repository (for example, ./composite-action).
  • action.yaml (or action.yml) exists at that path and is committed to the branch the workflow runs on.
  • The workflow runs on the branch where action.yaml was committed.
If your action is inside a subdirectory, make sure the uses: ./path/to/action path is relative to the repository root and that the action file (action.yaml or action.yml) is present and committed to the branch that triggers the workflow.

5. Example runner log (successful run)

Below is a typical excerpt from a successful workflow run after resolving a path issue. It shows the checkout step, the composite action invocation, and the two steps inside the composite action executing:
This confirms the composite action executed correctly and its steps ran as expected.

Further reading & references

Watch Video