<p>The problem is because you used double quotes. In conditionals, you have to use single quotes. Not</p>
<pre><code>if: env.foo == &quot;foo&quot;
</code></pre>
<p>But,</p>
<pre><code>if: env.foo == 'foo'
</code></pre>
<p>Then you should see this in DEBUG,</p>
<pre><code>##[debug]Evaluating condition for step: 'Conditional Test'
##[debug]Evaluating: (success() &amp;&amp; (env.foo == 'foo'))
##[debug]Evaluating And:
##[debug]..Evaluating success:
##[debug]..=&gt; true
##[debug]..Evaluating Equal:
##[debug]....Evaluating Index:
##[debug]......Evaluating env:
##[debug]......=&gt; Object
##[debug]......Evaluating String:
##[debug]......=&gt; 'foo'
##[debug]....=&gt; null
##[debug]....Evaluating String:
##[debug]....=&gt; 'foo'
##[debug]..=&gt; false
##[debug]=&gt; false
##[debug]Expanded: (true &amp;&amp; (null == 'foo'))
##[debug]Result: false
</code></pre>

CC BY-SA 4.0
2024-12-03T19:28:54.653Z
2024-12-03T19:28:54.653Z
Evan Carroll
<p>When when I execute this job,</p>
<pre class="lang-yaml prettyprint-override"><code>jobs:
  foo:
    runs-on: ubuntu-latest
    env:
      bar: foo
    steps:
      - name: Conditional Test
        if: env.foo == &quot;foo&quot;
</code></pre>
<p>I get this response,</p>
<blockquote>
<p>The workflow is not valid. .github/workflows/build-plugin.yml (Line: 18, Col: 13): Unexpected symbol: '&quot;foo&quot;'. Located at position 12 within expression: env.foo == &quot;foo&quot;</p>
</blockquote>

<github-actions>
GitHub Actions returns Unexpected symbol: '"foo"' on my simple conditional statement
Evan Carroll
# GitHub Actions returns Unexpected symbol: '"foo"' on my simple conditional statement

(Asked by: username_0 on 2024-12-03)

When when I execute this job,
jobs:
  foo:
    runs-on: ubuntu-latest
    env:
      bar: foo
    steps:
      - name: Conditional Test
        if: env.foo == "foo"

I get this response,

The workflow is not valid. .github/workflows/build-plugin.yml (Line: 18, Col: 13): Unexpected symbol: '"foo"'. Located at position 12 within expression: env.foo == "foo"

**Tags:** github-actions


---

## 1 answers

### Answer by username_0 on 2024-12-03. Score: 0 | Accepted answer

The problem is because you used double quotes. In conditionals, you have to use single quotes. Not
if: env.foo == "foo"

But,
if: env.foo == 'foo'

Then you should see this in DEBUG,
##[debug]Evaluating condition for step: 'Conditional Test'
##[debug]Evaluating: (success() && (env.foo == 'foo'))
##[debug]Evaluating And:
##[debug]..Evaluating success:
##[debug]..=> true
##[debug]..Evaluating Equal:
##[debug]....Evaluating Index:
##[debug]......Evaluating env:
##[debug]......=> Object
##[debug]......Evaluating String:
##[debug]......=> 'foo'
##[debug]....=> null
##[debug]....Evaluating String:
##[debug]....=> 'foo'
##[debug]..=> false
##[debug]=> false
##[debug]Expanded: (true && (null == 'foo'))
##[debug]Result: false


---

