- 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
- At the root of your repository create a folder named
composite-action. - Inside that folder add an
action.yamlfile with the following contents:
inputs.environmentis declared as required so callers must provide a value.runs.using: "composite"tells GitHub this action is a composite action, composed of the listedsteps.- Replace the sample
echosteps with real tasks (install dependencies, run linters, run tests, etc.) as appropriate for your project.
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:
- 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.](https://mintcdn.com/kodekloud-c4ac6d9a/IdpF6mT8Tun72cng/images/GitHub-Administration-Certification/GitHub-Actions-and-Runners/Demo-Composite-Actions/github-dark-tree-commit-skipci-actions.jpg?fit=max&auto=format&n=IdpF6mT8Tun72cng&q=85&s=38b76026796aec09ea29582ac17a5bcd)
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(oraction.yml) exists at that path and is committed to the branch the workflow runs on.- The workflow runs on the branch where
action.yamlwas 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.