GitHub Actions "job ... uses ... and also defines steps" in CI
A single job either calls a reusable workflow (uses: at the job level) or runs its own steps:. Mixing them in one job is invalid; the caller job that uses a reusable workflow cannot also list steps, runs-on, or a container.
What this error means
Parsing fails with a message that a job calling a reusable workflow cannot also define steps (or runs-on, container, services). The offending job has both uses: and steps:.
Invalid workflow file: .github/workflows/ci.yml#L14
The job "deploy" calls a reusable workflow with "uses" and therefore
cannot have "steps". Remove "steps" or split into a separate job.Common causes
Steps were added to a calling job
You added a checkout or setup step directly inside the job that has uses:. A calling job runs only the reusable workflow, so it accepts no steps.
runs-on or container set on a calling job
A calling job also rejects runs-on, container, and services; those belong to the jobs inside the reusable workflow.
How to fix it
Split the extra work into its own job
- Keep the calling job with only
uses:andwith:/secrets:. - Move any steps into a separate job.
- Wire order with
needs:if the step job must run first.
jobs:
prep:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
deploy:
needs: prep
uses: ./.github/workflows/deploy.ymlMove runner config into the reusable workflow
Set runs-on and any container on the jobs defined inside the called workflow, not on the calling job.
# in deploy.yml
jobs:
run:
runs-on: ubuntu-latest
steps:
- run: ./deploy.shHow to prevent it
- Treat a calling job as a pure invocation: only uses, with, secrets, needs, if.
- Put setup steps in a separate job connected by needs.
- Define runs-on and containers inside the reusable workflow.