jnus / json-variables Goto Github PK
View Code? Open in Web Editor NEWLicense: BSD 3-Clause "New" or "Revised" License
License: BSD 3-Clause "New" or "Revised" License
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": {}
}
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.
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}"
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"
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.
Variable substituion does not support secrets yet. Secrets must be substituted correctly, before the vaiables are rendered as environment variables.
Having two identical variables, one with an environment scope and one without (applies to all environment), renders the variable incorrectly. Both values of the variable is rendered in the environment variable.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.