Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Unexpected token *** in JSON #111

Open
GroJooo opened this issue Mar 29, 2024 · 0 comments
Open

Error: Unexpected token *** in JSON #111

GroJooo opened this issue Mar 29, 2024 · 0 comments

Comments

@GroJooo
Copy link

GroJooo commented Mar 29, 2024

Hi everyone,
In my build-and-deploy.yml workflow, I have the following:

on:
  workflow_dispatch:

    inputs:

      environment:
        required: true
        default: 'test'
        type: choice
        description: Which environment ?
        options:
          - test
          - staging
          - prod
      
      build_assets:
        required: false
        type: boolean
        description: Build assets ?

jobs:
  build:
    runs-on: ubuntu-22.04
    steps:
    
    - name: Project Checkout
      uses: actions/checkout@v3
    
    - name: Node version Setup
      uses: actions/setup-node@v3
      with:
        node-version: '18.17.1'
        cache: 'npm'

    - name: Map environment variables
      uses: kanga333/variable-mapper@master
      with:
        key: "${{inputs.environment}}"
        map: |
          {
            "prod": {
              "environment": "production",
              "AWS_SECRET_ACCESS_KEY": "${{ secrets.SSH_PRIVATE_KEY }}"
            },
            "staging": {
              "environment": "staging",
              "AWS_SECRET_ACCESS_KEY": "${{ secrets.SSH_PRIVATE_KEY_STAGING }}"
            },
            ".*": {
              "environment": "test",
              "AWS_SECRET_ACCESS_KEY": "${{ secrets.SSH_PRIVATE_KEY_TEST }}"
            }
          }

    - name: Echo environment
      run: echo ${{ env.environment }}

My worflow fails with following error:

Run kanga333/variable-mapper@master
  with:
    key: test
    map: {
    "prod": {
      "environment": "production",
      "AWS_SECRET_ACCESS_KEY": "***"
    },
    "staging": {
      "environment": "staging",
      "AWS_SECRET_ACCESS_KEY": "***"
    },
    ".*": {
      "environment": "test",
      "AWS_SECRET_ACCESS_KEY": "***"
    }
  }
  
    export_to: log,env
    mode: first_match
Error: Unexpected token 
 in JSON at position 108

I've already checked that my map JSON is correct, I don't get what I'm missing here
Can somebody help me ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant