This action helps you to edit property values in a JSON file. For example, if you're using .NET Core, you can use this action to edit your appsettings.json file.
To edit a connection string inside of an appsettings.json file:
- name: Edit property string value in appsettings.json
uses: benday-inc/set-property-value-in-appsettings@main
with:
pathtosettingsfile: '${{ github.workspace }}/Benday.Demo123/src/Benday.Demo123.WebUi/appsettings.json'
keyname1: 'level1'
keyname2: 'level2'
keyname3: 'level3'
valuetoset: 'the new value'
The yaml sample above would set the following value in a json file:
{
"level1": {
"level2": {
"level3": "the new value"
}
}
}
- None
pathtosettingsfile
- Path to the json (ex: appsettings.json) filevaluetoset
- The string value to setkeyname1
- Name for the root level propertykeyname2
- [optional] Name for the second level propertykeyname3
- [optional] Name for the third level property
- None