Skip to content

Commit 7744c6e

Browse files
committed
update readme
1 parent dd76029 commit 7744c6e

File tree

1 file changed

+47
-2
lines changed

1 file changed

+47
-2
lines changed

README.md

+47-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,48 @@
1-
## Update Json File action
1+
# GitHub Action - Update JSON File
2+
This GitHub Action edits the provided fields on a provided JSON file
23

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+
uses: restack/[email protected]
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+
uses: jossef/[email protected]
45+
with:
46+
file: package.json
47+
fields: "{'version': '1.2.4'}"
48+
```

0 commit comments

Comments
 (0)