Add GH action: convert yaml to 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: | |
should_download: | |
description: "Download JSON artifacts if called by another workflow?" | |
type: boolean | |
outputs: | |
is_valid: | |
description: "Is the JSON valid?" | |
value: ${{ jobs.validate.outputs.is_valid}} | |
pull_request: | |
branches: ["*"] | |
workflow_dispatch: | |
jobs: | |
validate: | |
runs-on: ubuntu-latest | |
outputs: | |
is_valid: ${{ steps.save_state.outputs.is_valid}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download JSON artifacts # if called by another workflow | |
if: ${{ inputs.should_download }} | |
uses: actions/download-artifact@v4 | |
with: | |
name: json-files | |
path: json | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
# cache: "pip" | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ">=1.22.4" | |
- name: Install Go dependencies | |
run: go install github.com/santhosh-tekuri/jsonschema/cmd/jv@latest | |
- name: Validate JSON files | |
id: validate_json | |
run: python validate-json.py schema.json json | |
- name: Save state | |
id: save_state | |
if: steps.validate_json.conclusion == 'success' | |
run: echo "is_valid=true" >> $GITHUB_OUTPUT |