Problem
A workflow referenced a custom action stored in the same repository:
- name: Run deployment checks
uses: ./.github/actions/deployment-checkThe job failed with an error similar to:
Can't find 'action.yml', 'action.yaml' or 'Dockerfile'The file existed at .github/actions/deployment-check/action.yml, so the path initially looked correct.
Root Cause
The workflow tried to run the local action before checking out the repository. Local action paths are resolved inside the runner workspace. Without actions/checkout, that workspace did not contain the repository files.
Fix
Checkout the repository before calling the local action:
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run deployment checks
uses: ./.github/actions/deployment-checkThen verify that the metadata file is located exactly where the uses path points:
.github/
actions/
deployment-check/
action.ymlPaths on Linux runners are case-sensitive. Deployment-Check and deployment-check are different directories.
Additional Checks
If checkout is already present:
- Confirm checkout and the action run in the same job.
- Check whether
actions/checkoutuses a custompath; localusesmust reflect that directory. - Ensure sparse checkout includes
.github/actions. - Confirm
action.ymlis committed, not merely present locally. - Do not add
@branchto a relative local-action path.
Lesson
uses: ./path does not fetch an action. It loads files from the current runner workspace. Always checkout first, then reference the directory containing action.yml.