Skip to content

Setting environment or secrets variables breaks the JSON layout #182

@gullevek

Description

@gullevek

If you used ${{ ... }} in the data: block it will break the JSON output because the whole content will be send quoted and so all quotes inside are escaped

name: Some Test
on:
  workflow_dispatch:
run-name: ${{ github.actor}} some test
jobs:
  debug:
    name: Some test
    runs-on: ubuntu-latest
    steps:
      - name: ome Test
        env:
          test_secret: ${{ secrets.TEST_SECRET }}
          test_variable: ${{ vars.TEST_VARIABLE }}
        uses: fjogeleit/http-request-action@v1
        with:
          url: 'https://some.url/target/'
          method: 'POST'
          customHeaders: '{"Content-Type": "application/json"}'
          data:
            '{
            "test_secret": "${{ secrets.TEST_SECRET }}",
            "test_variable_a": "${{ env.test_variable }}",
            "test_variable_b": "${{ vars.TEST_VARIABLE }}",
            "foo": "bar",
            "krampf": "wanz"
            }'

The output from above will be:

"{ \"test_secret\": \"This is a secret\", \"test_variable_a\": \"This is a variable\", \"test_variable_b\": \"This is a variable\", \"foo\": \"bar\", \"krampf\": \"wanz\" }"

If the ${{ ... }} blocks are removed

{ "foo": "bar", "krampf": "wanz" }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions