Validate JSON #11
Workflow file for this run
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
name: Validate JSON | |
on: | |
workflow_call: | |
inputs: | |
FILENAME: | |
required: true | |
type: string | |
workflow_dispatch: | |
inputs: | |
FILENAME: | |
required: true | |
type: string | |
jobs: | |
validate-json: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
path: fts3-databases | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' # Use the Node.js version you prefer | |
- name: Install dependencies | |
run: npm install ajv-cli | |
- name: Validate JSON | |
run: | | |
FILENAME="./fts3-databases/databases/${{ inputs.FILENAME || github.event.inputs.FILENAME }}" | |
SCHEMA="./fts3-databases/databases/database_schema.json" | |
if npx ajv -s "$SCHEMA" -d "$FILENAME"; then | |
echo "JSON is valid." | |
else | |
echo "JSON is invalid." | |
exit 1 | |
fi |