GitHub Actions "Unexpected symbol" in a ${{ }} Expression
An expression inside ${{ }} could not be parsed. A string literal is unquoted, an operator is wrong, or a stray character broke the expression grammar.
What this error means
The workflow is invalid with "Unexpected symbol", pointing at a position inside an expression. The YAML is fine; the expression itself does not parse.
The workflow is not valid. .github/workflows/ci.yml (Line: 10, Col: 11):
Unexpected symbol: '"main'. Located at position 18 within expression: github.ref == "mainCommon causes
String literal not single-quoted
Expression string literals use single quotes. Using double quotes, or an unterminated quote, breaks the parser with "Unexpected symbol".
Bad operator or stray character
A typo like = instead of ==, a misplaced brace, or text glued to an expression produces an unparseable symbol.
How to fix it
Quote literals with single quotes
Use single quotes for string literals and the correct comparison operators inside the expression.
if: ${{ github.ref == 'refs/heads/main' }}Check braces and operators
- Confirm each ${{ has a matching }} and no nested unescaped braces.
- Use ==, !=, &&, ||, and functions like contains() - not assignment operators.
- Validate expressions with actionlint, which parses the expression grammar.
How to prevent it
- Single-quote all string literals in expressions.
- Keep one complete expression per ${{ }} with matching braces.
- Lint expressions with actionlint, not just the YAML.