title: How to pass Github secrets as value in json file?
body: <p>I'm using <a href="https://docs.cypress.io/guides/overview/why-cypress" rel="nofollow noreferrer">Cypress.io</a> for my automated tests &amp; triggering it in CI/D with <a href="https://github.com/features/actions" rel="nofollow noreferrer">Github Actions</a>. The config <code>cypress.json</code> file has nested <code>env</code> values like so:</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;baseUrl&quot;: &quot;&lt;url-to-login&gt;&quot;,
    &quot;env&quot;: {
      &quot;roles&quot;: {
        &quot;admin&quot;: {
          &quot;PASSWORD&quot;: &quot;&lt;password&gt;&quot;,
          &quot;USERNAME&quot;: &quot;&lt;username&gt;&quot;
        },
        &quot;employee&quot;: {
          &quot;PASSWORD&quot;: &quot;&lt;password&gt;&quot;,
          &quot;USERNAME&quot;: &quot;&lt;username&gt;&quot;
        },
        &quot;client&quot;: {
          &quot;PASSWORD&quot;: &quot;&lt;password&gt;&quot;,
          &quot;USERNAME&quot;: &quot;&lt;username&gt;&quot;
        }
      }
    }
  }
  </code></pre>
  <p>Unfortunately, <a href="https://github.com/cypress-io/cypress/issues/1736" rel="nofollow noreferrer">Cypress can't access deeply env variables</a> so I'm creating the config <code>cypress.json</code> like so:</p>
  <pre class="lang-yaml prettyprint-override"><code>name: Cypress Tests
  
  on: [push]
  
  jobs:
    cypress-run:
      runs-on: ubuntu-latest
      steps:
        - name: Checkout
          uses: actions/checkout@v2
          # creates cypress.json file to run Cypress
        - name: Create Cypress config files
          run: |
            echo '{ &quot;baseUrl&quot;: &quot;${{ secrets.BASE_URL }}&quot;, &quot;env&quot;: { &quot;roles&quot;: { &quot;admin&quot;: { &quot;PASSWORD&quot;: &quot;${{ secrets.PASSWORD }}&quot;, &quot;USERNAME&quot;: &quot;${{ secrets.USERNAME }}&quot; } } } }' &gt; cypress.json
        - name: Cypress run
          uses: cypress-io/github-action@v2
          with:
            build: yarn run
            start: yarn cypress:run
            wait-on-timeout: 120
            browser: chrome
  
  </code></pre>
  <p>It doesn't work, but I hardcoded the values it did work like so:</p>
  <pre class="lang-yaml prettyprint-override"><code>run: |
            echo '{ &quot;baseUrl&quot;: &quot;&lt;hardcoded-redacted-value&gt;&quot;, &quot;env&quot;: { &quot;roles&quot;: { &quot;admin&quot;: { &quot;PASSWORD&quot;: &quot;&lt;hardcoded-redacted-value&gt;&quot;, &quot;USERNAME&quot;: &quot;&lt;hardcoded-redacted-value&gt;&quot; } } } }' &gt; cypress.json
  </code></pre>
  <p>So my question is, how to pass the secret in the <code>json</code> file?</p>