Skip to content

Commit

Permalink
feat: add unset input.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Oct 31, 2022
1 parent e0c921e commit b49e322
Show file tree
Hide file tree
Showing 7 changed files with 582 additions and 116 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ jobs:
- run: echo "os - ${{ steps.info2.outputs.os }}"
- run: echo "cpu - ${{ steps.info2.outputs.cpu }}"

- name: delete nested values
uses: ./
with:
unset: scripts.watch,lint-staged,devDependencies

- run: cat package.json

- name: Generate Changelog
id: changelog
uses: jaywcjlove/changelog-generator@main
Expand Down
1 change: 1 addition & 0 deletions .husky/pre-commit

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,48 @@ Read and modify the contents of `package.json`.
- run: echo "author - ${{ steps.info.outputs.author }}"
```
### delete nested values
```json
{
"name": "github-action-package",
"author": "jaywcjlove",
"repository": {
"type": "git",
"url": "https://github.com/jaywcjlove/github-action-package"
},
"keywords": [
"actions",
"package"
]
}
```

```yml
- name: package.json info
uses: jaywcjlove/github-action-package@main
with:
unset: repository.type,repository.url,keywords
```
Output:
```json
{
"name": "github-action-package",
"author": "jaywcjlove",
"repository": {}
}
```

## Inputs

- `path` The path of the `package.json` file. Default: `package.json`
- `data` json data for changing `package.json`. Default: `{}`
- `rename` Used to change "name" data in "package.json".
- `version` Used to change "`version`" data in "package.json".
- `description` Used to change "`description`" data in "package.json".
- `unset` delete "Object" nested values in "package.json".

### Output Parameters

Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ inputs:
description: Used to change "`description`" data in "package.json".
required: false

unset:
description: delete "Object" nested values
required: false

outputs:
name:
description: 'name field in package.json, The name of the package.'
Expand Down
Loading

0 comments on commit b49e322

Please # to comment.