Skip to content

Commit

Permalink
feat(json-schema-check): add new action (#240)
Browse files Browse the repository at this point in the history
* feat(json-schema-check): add new action

The goal is to check the compliance of configuration files against their
Schema template.

Leveraging the check-jsonschema CLI tool.

Issue-Id: SCM-6366
Signed-off-by: Ambroise Vincent <[email protected]>
Change-Id: I3ca864e58d408e85ed049266c3e703b8a19220b9

* Update json-schema-check/README.md

* Update README.md

---------

Signed-off-by: Ambroise Vincent <[email protected]>
Co-authored-by: Kenji Miyake <[email protected]>
  • Loading branch information
ambroise-arm and kenji-miyake authored Jun 26, 2023
1 parent 73d6852 commit 92ca968
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ See the `README.md` in each directory.
- [generate-changelog](./generate-changelog/README.md)
- [get-modified-packages](./get-modified-packages/README.md)
- [get-self-packages](./get-self-packages/README.md)
- [json-schema-check](./json-schema-check/README.md)
- [pre-commit](./pre-commit/README.md)
- [register-autonomoustuff-repository](./register-autonomoustuff-repository/README.md)
- [remove-exec-depend](./remove-exec-depend/README.md)
Expand Down
29 changes: 29 additions & 0 deletions json-schema-check/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# json-schema-check

## Description

This action checks if the ROS 2 parameter files (`config/*.param.yaml`) of packages comply with the format of their template JSON Schema file (`schema/*.schema.json`).

## Usage

```yaml
jobs:
json-schema-check:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Run json-schema-check
uses: autowarefoundation/autoware-github-actions/json-schema-check@v1
```
## Inputs
None.
## Outputs
None.
15 changes: 15 additions & 0 deletions json-schema-check/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: json-schema-check
description: ""

runs:
using: composite
steps:
- name: Install JSON Schema packages
run: |
pip3 install -U check-jsonschema
shell: bash

- name: Check configuration files
run: |
find -wholename '*/schema/*.schema.json' -execdir bash -c 'check-jsonschema --schemafile "$1" ../config/*.param.yaml' bash '{}' +
shell: bash

0 comments on commit 92ca968

Please sign in to comment.