GithubHelp home page GithubHelp logo

jnus / json-variables Goto Github PK

View Code? Open in Web Editor NEW
10.0 10.0 2.0 119 KB

License: BSD 3-Clause "New" or "Revised" License

PowerShell 100.00%
deployment environment-variables github-actions hacktoberfest

json-variables's People

Contributors

jnus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

json-variables's Issues

Github env variable support when rendering variables

You should be able to use the pre-existing GitHub environment variables, when specifying your variables in a json file. Both the GitHub and env context should be supported with the normal ${{ }} expression syntax.

E.g.

}
  "Name": "ApplicationSettings.Version",
  "Value": "1.0.0.${{ github.run_number }}",
  "Scope": {}
} 

Secrets default parameter

The secrets parameter should be set per default in the action, but letting the user overwrite it and customize which secrets are injected in the action.

secrets variables parsing error

Hi, thank you for the action!

I'm testing it and keep receiving the following error when it tries to parse the secrets:

Run jnus/json-variables@2774d3ea74614517d29d03244839b7056cfa2e8e
Run /home/runner/work/_actions/jnus/json-variables/2774d3ea74614517d2[9](https://github.com/ockam/ga-vars-test/actions/runs/6930834115/job/18851255893#step:2:10)d03244839b7056cfa2e8e/src/Set-JsonVariables.ps1 -scope Dev -configFile .github/variables.json' -secrets '{
ParserError: /home/runner/work/_temp/203fec55-2f29-4d57-90d2-e064229911d2.ps1:3
Line |
   3 |    "github_token": "***",
     |                  ~
     | Unexpected token ':' in expression or statement.

Error: Process completed with exit code 1.

Am I doing something wrong or this is a bug?

Here's my variables ./.github/variables.json:

{
  "Variables": [
    {
      "Name": "HostName",
      "Value": "someDevHostName",
      "Scope": {
        "Environment": ["Dev"]
      }
    },
    {
      "Name": "TOKEN_FROM_SECRETS",
      "Value": "${{secrets.TOKEN_FROM_SECRETS}}",
      "Scope": {}
    }
  ]
}

And my test workflow ./.github/workflows/test.yml:

name: A Test Workflow
on:
  workflow_dispatch:
  push:
    branches:
      - main

jobs:
  echo-vars:
    runs-on: ubuntu-latest
    steps:
      - name: Set environment specific variables
        uses: jnus/json-variables@2774d3ea74614517d29d03244839b7056cfa2e8e
        with:
          scope: Dev
          configFile: .github/variables.json'
          secrets: '${{toJson(secrets)}}'

      - name: Echo
        run: |
          echo "HostName is ${env.HostName}"
          echo "TOKEN_FROM_SECRETS is ${env.TOKEN_FROM_SECRETS}"

Multiple unique substitutions not supported

Having a variable with multiple unique substitutions, the action substitutes the in place variables the wrong way.

E.g.
Username: john
DatabaseName: foo
DatabaseUrl: sql.company.com
ConnectionString = "server=#{ServerUrl};database=#{DatabaseName};Username=#{Username}"
Will render it as:
ConnectionString = "server=sql.company.com;database=sql.company.com;Username=john"

Should be:
ConnectionString = "server=sql.company.com;database=foo;Username=john"

Support for multiple prioritized variable files

Action needs to be able to accept multiple variables files, where the order specified is the priority when rendering the environment variables. This will give the possibility to incooperate shared configurations via e.g. sub-moduling.

Support substitution of secrets

Variable substituion does not support secrets yet. Secrets must be substituted correctly, before the vaiables are rendered as environment variables.

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.