Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/valentinvignal/action-json-keys
A GitHub action to check keys of json files
https://github.com/valentinvignal/action-json-keys
Last synced: about 9 hours ago
JSON representation
A GitHub action to check keys of json files
- Host: GitHub
- URL: https://github.com/valentinvignal/action-json-keys
- Owner: ValentinVignal
- License: mit
- Created: 2021-04-18T15:38:25.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-04-24T12:25:50.000Z (over 3 years ago)
- Last Synced: 2024-11-15T18:46:48.248Z (4 days ago)
- Language: TypeScript
- Size: 71.3 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# action-json-keys
A GitHub action to check keys of json files
## How to use itCreate a `.yml` file in `./github/workflows/` in your project.
## Inputs
- `file-matcher`: Minimatch expression of the json files to check.
- Optional.
- Default: `'**/*.json'`.
- `order`: The alphabetical key order.
- Options: `'acs'`, `'desc'`.
- Optional.
- Default: `'asc'`.
- `key-format`: Format of the keys.
- Options: `'snake_case'`, `'camelCase'`, `'PascalCase'`, `'kebab-case'`.
You can also put your custom regular expression.
- Optional.
- Default: `'camelCase'`.
## Outputs
No output.
## Result
It will fail the checks on your Pull Requests if any issue is found.
## Example usage
```yml
on: [pull_request]jobs:
linter:
runs-on: ubuntu-latest
name: Check JSON keys
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Check json files
uses: ValentinVignal/[email protected]
with:
file-matcher: 'json/**/*.json'
```If you want to use your own regular expression, you can use the option `key-format`:
```yml
on: [pull_request]jobs:
linter:
runs-on: ubuntu-latest
name: Check JSON keys
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Check json files
uses: ValentinVignal/[email protected]
with:
file-matcher: 'json/**/*.json'
key-format: '^(([A-Z]{2})|([a-z0-9_]*))$' # snake_case or country code```