https://github.com/jaywcjlove/github-action-package
Read and modify the contents of package.json.
https://github.com/jaywcjlove/github-action-package
Last synced: about 2 months ago
JSON representation
Read and modify the contents of package.json.
- Host: GitHub
- URL: https://github.com/jaywcjlove/github-action-package
- Owner: jaywcjlove
- Created: 2022-06-28T12:36:59.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-25T16:20:18.000Z (12 months ago)
- Last Synced: 2024-10-29T23:50:47.823Z (7 months ago)
- Language: TypeScript
- Homepage: https://jaywcjlove.github.io/github-action-package
- Size: 441 KB
- Stars: 24
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
github-action-package
===[](https://jaywcjlove.github.io/#/sponsor)
[](https://github.com/jaywcjlove/github-action-package/actions/workflows/ci.yml)Read and modify the contents of `package.json`.
## Example Usage
```yaml
- name: package.json info
id: info
uses: jaywcjlove/github-action-package@main- run: echo "name - ${{ steps.info.outputs.name }}"
- run: echo "version - ${{ steps.info.outputs.version }}"
- run: echo "description - ${{ steps.info.outputs.description }}"
- run: echo "author - ${{ steps.info.outputs.author }}"
``````yaml
- name: package.json info
id: info
uses: jaywcjlove/github-action-package@main
with:
data: |
{
"name": "@jaywcjlove/github-action-package-test"
}- run: echo "name - ${{ steps.info.outputs.name }}"
- run: echo "version - ${{ steps.info.outputs.version }}"
- run: echo "description - ${{ steps.info.outputs.description }}"
- run: echo "author - ${{ steps.info.outputs.author }}"
``````yaml
- name: package.json info
id: info
uses: jaywcjlove/github-action-package@main
with:
rename: '@jaywcjlove/github-action-package-test'- run: echo "name - ${{ steps.info.outputs.name }}"
- run: echo "version - ${{ steps.info.outputs.version }}"
- run: echo "description - ${{ steps.info.outputs.description }}"
- 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
- `name` The name of the package.
- `description` This helps people discover your package, as it's listed in 'npm search'.
- `version` Version must be parseable by node-semver, which is bundled with npm as a dependency.
- `homepage` The url to the project homepage.
- `author` author field in package.json
- `private` private field in package.json
- `license` You should specify a license for your package so that people know how they are permitted to use it, and any restrictions you're placing on it.
- `author` This helps people discover your package as it's listed in 'npm search'.
- `keywords` This helps people discover your package as it's listed in 'npm search'.
- `repository` Specify the place where your code lives. This is helpful for people who want to contribute.
- `os` Specify which operating systems your module will run on.
- `cpu` cpu field in package.json## See Also
- [Create Tags From](https://github.com/jaywcjlove/create-tag-action) Auto create tags from commit or package.json.
- [Github Release Changelog Generator](https://github.com/jaywcjlove/changelog-generator) A GitHub Action that compares the commit differences between two branches
- [Github Action Contributors](https://github.com/jaywcjlove/github-action-contributors) Github action generates dynamic image URL for contributor list to display it!
- [Generated Badges](https://github.com/jaywcjlove/generated-badges) Create a badge using GitHub Actions and GitHub Workflow CPU time (no 3rd parties servers)
- [Create Coverage Badges](https://github.com/jaywcjlove/coverage-badges-cli) Create coverage badges from coverage reports. (no 3rd parties servers)
- [Action EJS](https://github.com/jaywcjlove/action-ejs) A github action to render a [`ejs`](https://github.com/mde/ejs) template using github context## Contributors
As always, thanks to our amazing contributors!
Made with [action-contributors](https://github.com/jaywcjlove/github-action-contributors).
## License
Licensed under the MIT License.