Home > Software design >  Passing Env Variables from GitHub action to json
Passing Env Variables from GitHub action to json

Time:11-07

I want to pass the env variable from GitHub Action to my config.json file, How to pass the env variables to json file.

In GitHub action secret, I have set Node_Server_Url one of my IP address.

Config.json

{
  "SERVER_URL": "https://{ip}:9000",
}

CodePudding user response:

You could edit your config json files adding this step:

  - name: "inject server ip"
    env:
      server_ip: ${{ secrets.Node_Server_Url }}
    run: |
      sed -i "s/{ip}/$server_ip/g" config.json
  • Related