Skip to content

Update Json File

Actions
This GitHub Action edits any key in a json file to the provided values
2.1
Latest
Verified creator
Star (11)

Tags

 (1)

Verified

GitHub has manually verified the creator of the action as an official partner organization. For more info see About badges in GitHub Marketplace.

GitHub Action - Update JSON File

This GitHub Action edits the provided fields on a provided JSON file

Usage

Add this step in your workflow file

- name: Update my-file.json description
  uses: restackio/[email protected]
  with:
    file: my-file.json
    fields: "{'a.b.c': 'value_here', 'a.b.d[0]': 'value_here'}"

Input Variables

  • file: File name/path to edit. e.g package.json
  • fields: Fields to edit. can be nested fields. example: {'a.b.c[0]': 'value_here', 'z.x': 'value_here'}

Example - Updating package.json Version

name: Build and Release

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

env:
  GITHUB_TOKEN: ${{ github.token }}

jobs:
  build:
    name: Build and Release
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v3
 
    - name: Update package.json version
      uses: restackio/[email protected]
      with:
        file: package.json
        fields: "{\"input.test.type\": \"new value\"}"

Update Json File is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

This GitHub Action edits any key in a json file to the provided values
2.1
Latest

Verified

GitHub has manually verified the creator of the action as an official partner organization. For more info see About badges in GitHub Marketplace.

Tags

 (1)

Update Json File is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.