Skip to content
Latchkey

GitHub Actions Composite Action "no such file" - Use github.action_path

A composite action fails to run a script it ships because run: steps resolve paths from the consumer's workspace, not the action's own directory. The fix is to anchor paths to github.action_path.

What this error means

A composite action calls its own helper script (e.g. ./scripts/setup.sh) and fails with "No such file or directory", because the relative path is resolved from the caller's checkout, not the action.

.github/actions/setup/action.yml
# inside the composite action.yml
- run: ./scripts/setup.sh
  shell: bash
# fails: ./scripts is looked up in the CONSUMER's workspace, not the action

Diagnose it: print the context before you change anything

Most workflow-expression bugs are not syntax errors, they are an expression reading something that is empty. GitHub resolves a missing property to an empty string instead of failing the run, so a wrong reference looks like a logic bug rather than a mistake. Dump the contexts first and you will usually see the answer immediately.

.github/workflows/ci.yml
- name: Dump contexts
  run: |
    echo '--- github ---'   ; echo '${{ toJSON(github) }}'
    echo '--- needs ---'    ; echo '${{ toJSON(needs) }}'
    echo '--- steps ---'    ; echo '${{ toJSON(steps) }}'
    echo '--- matrix ---'   ; echo '${{ toJSON(matrix) }}'
    echo '--- inputs ---'   ; echo '${{ toJSON(inputs) }}'

Check the context is allowed where you used it

Contexts are not available everywhere. The same expression can be valid in a step if and invalid in a job if, which is why an expression that works in one workflow fails when moved.

Where you wrote itContexts available there
run-namegithub, inputs, vars
concurrencygithub, inputs, vars
Top-level envgithub, secrets, inputs, vars
jobs.<id>.ifgithub, needs, vars, inputs
jobs.<id>.steps.ifgithub, needs, strategy, matrix, job, runner, env, vars, steps, inputs
jobs.<id>.outputsFull access, including secrets
Reusable workflow outputsgithub, jobs, vars, inputs

Common causes

run: paths resolve from the workspace

In a composite action, run: steps execute with the consumer's working directory. A relative path to a file shipped inside the action does not exist there.

Action not checked out alongside its scripts

Bundled scripts live wherever the action was downloaded. Without github.action_path you have no stable way to reference them.

How to fix it

Anchor paths to github.action_path

Reference the action's own directory via the github.action_path context so bundled files resolve regardless of the consumer's workspace.

.github/actions/setup/action.yml
runs:
  using: composite
  steps:
    - run: "${{ github.action_path }}/scripts/setup.sh"
      shell: bash

Make scripts executable and portable

  1. chmod +x the bundled scripts (or invoke them via bash <path>).
  2. Use github.action_path for every file the action ships.
  3. Avoid assuming the consumer checked the action out into a known relative path.

Catch it before it reaches CI

Every failure in this cluster is statically detectable. actionlint parses workflow expressions, checks context availability against the same rules above, and validates needs references, so these bugs never need to cost you a run.

Terminal
# one-off
docker run --rm -v "$(pwd):/repo" --workdir /repo rhysd/actionlint:latest -color

# as a job, before anything expensive runs
- uses: actions/checkout@v4
- run: |
    bash <(curl -s https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
    ./actionlint -color

How to prevent it

  • Reference bundled action files via github.action_path.
  • Do not rely on relative paths to the consumer workspace inside an action.
  • Ship executable scripts or invoke them through an interpreter.

Frequently asked questions

What causes GitHub Actions composite action "no such file"?
There are 2 common causes: run: paths resolve from the workspace and action not checked out alongside its scripts. In a composite action, run: steps execute with the consumer's working directory.
How do I fix GitHub Actions composite action "no such file"?
There are 2 fixes depending on which cause you have: anchor paths to github.action_path and make scripts executable and portable. Work through them in order, since the first is the most common.
What does GitHub Actions composite action "no such file" actually mean?
A composite action calls its own helper script (e.g.
How do I stop GitHub Actions composite action "no such file" happening again?
Reference bundled action files via github.action_path. The prevention section lists 3 changes that keep it from recurring.

Related guides

References

Not every red build is your code. Latchkey repairs the ones that are not, on the runner. Start free → 30-day trial · No credit card