Skip to content

Commit

Permalink
Update validate_database_json.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
dweinholz authored Sep 21, 2023
1 parent 4090f87 commit ab1efe6
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions .github/workflows/validate_database_json.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Validate JSONs
name: Validate JSON

on:
workflow_call:
inputs:
FILENAME:
required: true
type: string
inputs:
FILENAME:
required: true
type: string

workflow_dispatch:
inputs:
Expand All @@ -14,14 +14,30 @@ on:
type: string

jobs:
verify-json-validation:
validate-json:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v2
with:
path: fts3-databases
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
uses: docker://orrosenblatt/validate-json-action:latest
env:
INPUT_SCHEMA: ./fts3-databases/databases/database_schema.json
INPUT_JSONS: ./fts3-databases/databases/${{ inputs.FILENAME || github.event.inputs.FILENAME }}"
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

0 comments on commit ab1efe6

Please sign in to comment.