-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from OrRosenblatt/changes-before-publishing
Changes before publishing
- Loading branch information
Showing
3 changed files
with
48 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,45 @@ | ||
# Github Action: Validate JSON | ||
Validate JSON with a single GitHub Action. | ||
A GitHub Action that validates JSON files based on a JSON Schema. | ||
|
||
This project uses [`ajv`](https://github.com/epoberezkin/ajv), fast JSON schema validator, to perform the validation. | ||
|
||
## Usage | ||
|
||
### Inputs | ||
|
||
- `schema`: Relative file path under the repository of a JSON schema file to validate the other JSON files with. Default is: `'./schema.json'`. | ||
- `jsons`: One or more relative file paths under the repository (seperated by comma) of the JSON files to validate with the schema provided. | ||
|
||
> Note: `schema` is **required**, otherwise default will be used. | ||
### Outputs | ||
|
||
- `invalid`: One or more of relative file paths of the invalid JSON files, found in the repository (seperated by comma). | ||
|
||
### Example Workflow | ||
|
||
An example `.github/workflows/validate.yml` workflow to run JSON validation on the repository: | ||
|
||
```yaml | ||
name: Validate JSON | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
validate: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: OrRosenblatt/validate-json-action@v1 | ||
- with: | ||
schema: /path/to/schema.json | ||
jsons: /path/to/file.json,/path/to/another/file.json | ||
``` | ||
## TODOs | ||
- [x] Initial validation action | ||
- [ ] Github workflow screenshots | ||
- [ ] Support `jsons` in PRs | ||
- [ ] Support `schema` & `jsons` by external reference (from S3/GitHub/etc...) | ||
- [ ] Support `delimiter` input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters