GitHub Actions: Common YAML Mistakes
YAML mistakes stop a workflow before it runs. Most of them come from spacing, tabs, or missing quotes.
Bad indent
The run line sits one space too far left. The parser cannot tell which step it belongs to.
steps:
- uses: actions/checkout@v7
- run: npm testA tab
A tab hides at the start of a line. YAML forbids tabs for indentation.
steps:
- uses: actions/checkout@v7
- run: npm testAn unquoted colon
The colon inside the value looks like a new key. Quotes fix it.
- run: echo Hello: SamThe quoted fix
Quotes tell YAML the whole text is one value.
- run: 'echo "Hello: Sam"'The on gotcha
Some YAML tools read on as the value true. GitHub reads it as the trigger word. Quote it when a tool shows true instead.
"on": pushExample
name: CI
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '24'
- run: npm testKey points
- Use spaces for indentation, never tabs.
- Keep items at the same level lined up exactly.
- Quote a value that holds a colon or a leading star.
- Some YAML tools read the word on as the value true.
- A YAML mistake shows as an error, not as a failed test.
- A workflow file is strict about spacing in a way code files are not.
In this example, the workflow is written with two-space indents and no tabs. The name line, the trigger line, and the job all line up as the last lesson showed. The run step has no stray colon, so nothing needs quotes here. The output shows both tests passing, so the file parsed cleanly.
Try it Yourself
Edit the code, then press Run.
Running is simulated · Rust Playground
Exercise
What should you use for indentation in a YAML workflow file?