File tree 1 file changed +47
-2
lines changed
1 file changed +47
-2
lines changed Original file line number Diff line number Diff line change 1
- ## Update Json File action
1
+ # GitHub Action - Update JSON File
2
+ This GitHub Action edits the provided fields on a provided JSON file
2
3
3
- This action will update any json fields from a file to the provided values
4
+ ## Usage
5
+
6
+ Add this step in your workflow file
7
+ ``` yaml
8
+ - name : Update my-file.json description
9
+
10
+ with :
11
+ file : my-file.json
12
+ fields : " {'a.b.c': 'value_here', 'a.b.d[0]': 'value_here'}"
13
+ ` ` `
14
+
15
+ ### Input Variables
16
+
17
+ - ` file`: File name/path to edit. e.g `package.json`
18
+ - `fields` : Fields to edit. can be nested fields. example: `{'a.b.c[0]': 'value_here', 'z.x': 'value_here'}`
19
+
20
+
21
+ # ### Example - Updating `package.json` Version
22
+
23
+ ` ` ` yaml
24
+ name: Build and Release
25
+
26
+ on:
27
+ push:
28
+ branches: [ master ]
29
+ pull_request:
30
+ branches: [ master ]
31
+
32
+ env:
33
+ GITHUB_TOKEN: ${{ github.token }}
34
+
35
+ jobs:
36
+ build:
37
+ name: Build and Release
38
+ runs-on: ubuntu-latest
39
+ steps:
40
+ - name: Checkout code
41
+ - uses: actions/checkout@v3
42
+
43
+ - name: Update package.json version
44
+
45
+ with:
46
+ file: package.json
47
+ fields: "{'version': '1.2.4'}"
48
+ ` ` `
You can’t perform that action at this time.
0 commit comments