Code Monkey home page Code Monkey logo

create-env-json's People

Contributors

dependabot[bot] avatar schdck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

create-env-json's Issues

JSON is all uppercase

Hi !

Look like I have an case issue with this github action. I specified lower case in the configuration and the generated file is in uppercase.

      - name: Write hg-version.json
        uses: schdck/create-env-json@v2
        id: create-env
        with:
          file-name: './public/hg-version.json'
          version: ${{ github.sha }}
          test: '123'
{"VERSION":"695927bb3fa6176ae36ccb2216aa53dc85b5b542","TEST":"123"}

Any recommendation ?

unable to pass GITHUB_REF var as input

Hi,

No matter which way I try I don't seem to be able to get the branch name from the default env var $GITHuB_REF to be read properly by the input variable.

The format I need to pass in is refs/head/branch-name

My Github Action as of my latest try is laid out as:

jobs:
  terraform:
    name: "Terraform"
    runs-on: ubuntu-latest
    env: 
      input: $GITHUB_REF
    
    steps:
      - name: Checkout
        uses: actions/[email protected]
        with:
          ref: ${{ github.head_ref }}
          token: ${{ secrets.CROSS_REPO_TOKEN }}
            
      - name: create json
        uses: schdck/create-env-json@v2
        id: create-env
        with:
          file-name: 'envs.json'
          dev: name
          branch: ${{ env.input }}  ------> problem variable which can't read a variable 
          queue: plan

      - name: create json var
        shell: bash
        run: |
          echo "branch = ${{ env.input }}"
          cat | tr '[:upper:]' '[:lower:]' < ${{ steps.create-env.outputs.full-path }} 
          FILE=$(cat | tr '[:upper:]' '[:lower:]' <  ${{ steps.create-env.outputs.full-path }})
          echo JSON=$FILE >> $GITHUB_ENV

I setup cat to check the json file which produces the following results:

The above code results in: {"DEV":"name","BRANCH":"$GITHUB_REF","QUEUE":"plan"}

What I've tried otherwise is referencing the default env var directly:
branch: $GITHUB_REF results in nothing being passed eg branch: {"DEV":"name","BRANCH":"","QUEUE":"plan"}

I am additionally echoing the variable so check the variable string and this returns the branch name as expected. Any idea as to why the create-env-json action cannot read the variables?

Thanks,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.