Skip to content

benday-inc/set-property-value-in-appsettings

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date
Dec 29, 2022
Nov 8, 2021
Dec 29, 2022
Oct 20, 2022
Nov 8, 2021
Oct 15, 2020
Nov 8, 2021
Oct 15, 2020
Oct 15, 2020
Oct 15, 2020
Oct 15, 2020
Oct 15, 2020
Nov 16, 2020
Dec 29, 2022
Oct 15, 2020
Oct 15, 2020
Sep 5, 2023
Sep 5, 2023
Oct 15, 2020

Repository files navigation

build-test

Edit a property value in JSON file

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.

Usage

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"
    }
  }
}

Action Spec:

Environment variables

  • None

Inputs

  • pathtosettingsfile - Path to the json (ex: appsettings.json) file
  • valuetoset - The string value to set
  • keyname1 - Name for the root level property
  • keyname2 - [optional] Name for the second level property
  • keyname3 - [optional] Name for the third level property

Outputs

  • None