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

Reference an external file containing the json map #59

Open
nwaughachukwuma opened this issue Aug 12, 2021 · 4 comments
Open

Reference an external file containing the json map #59

nwaughachukwuma opened this issue Aug 12, 2021 · 4 comments

Comments

@nwaughachukwuma
Copy link

nwaughachukwuma commented Aug 12, 2021

It would be nice if we can make reference to an external file containing the JSON map.

@mrmeyers99
Copy link
Contributor

It would be nice if this was supported out of the box. The simplest way I found to do it is like this:

      - id: var-map
        run: |
          echo ::set-output name=content::$(cat ./.github/env_vars.json)

      - uses: kanga333/variable-mapper@master
        id: export
        with:
          key: "key"
          map: ${{ steps.var-map.outputs.content }}
          export_to: log,output

@kanga333
Copy link
Owner

kanga333 commented Oct 7, 2021

@nwaughachukwuma Thanks for the report. And I'm sorry for the delay in replying. @mrmeyers99's workaround is very good! But, I will try to support option that read map file directly like below.

- uses: kanga333/variable-mapper@master
    id: export
    with:
      key: "key"
      map_file: "./.github/env_vars.json"
      export_to: log,output

@nwaughachukwuma
Copy link
Author

OK thanks @kanga333. And thanks @mrmeyers99

@RafPe
Copy link

RafPe commented Jun 14, 2023

@mrmeyers99 I use with just passing the value as env but you can as well pass the map from output of your step

      - uses: kanga333/variable-mapper@master
        id: export
        with:
          key: "${{ env.CI_ACTION_REF_NAME }}"
          export_to: env,log,output
          map: '${{ vars.CICD_CONFIG_STRATEGY_MAPPER }}'

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

4 participants