GitHub Actions "a step cannot have both the uses and run keys"
By Daniel Zoghalchali·Latchkey
A step is either an action (uses) or a shell command (run), never both. Declaring uses and run in the same step is ambiguous and rejected at parse time.
What this error means
The workflow fails to start with "a step cannot have both the uses and run keys", pointing at a step that declares both.
github-actions
Error: a step cannot have both the `uses` and `run` keys
Common causes
Merged two steps into one
An action step and a command step were accidentally combined under a single list item.
Indentation collapsed two steps
Wrong YAML indentation made a run line attach to a uses step.
How to fix it
Split into separate steps
Put the action in its own step with uses.
Put the command in a separate step with run.
Fix indentation so each is a distinct list item.
.github/workflows/ci.yml
steps:- uses:actions/checkout@v4- run:npm ci && npm test
How to prevent it
Keep one action or one command per step, never both.
Watch step indentation so lines do not merge.
Lint workflows to catch uses+run on one step.
Frequently asked questions
What causes ""Step cannot have both uses and run""?
An action step and a command step were accidentally combined under a single list item.
How do I fix "Step cannot have both uses and run"?