feat: init project #2
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 updates | |
on: | |
push: | |
paths: | |
- 'updates.yaml' | |
- 'updates.schema.json' | |
pull_request: | |
paths: | |
- 'updates.yaml' | |
- 'updates.schema.json' | |
jobs: | |
validate-yaml: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y yq | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Install Ajv CLI and js-yaml | |
run: | | |
npm install -g ajv-cli | |
- name: Validate updates.yaml | |
id: validate-updates | |
run: | | |
yq updates.yaml -ojson > converted-file.json | |
ajv validate -s updates.schema.json -d converted-file.json | |
- name: Print success message | |
if: success() | |
run: echo "YAML file validated successfully against the schema." | |
- name: Print failure message | |
if: failure() | |
run: echo "YAML validation failed. Check the schema and the YAML file." |