Skip to content

Commit

Permalink
Merge pull request Azure#434 from jfaurskov/yml-validation
Browse files Browse the repository at this point in the history
Github action to validate yml schemas
  • Loading branch information
judyer28 authored Nov 26, 2024
2 parents 8d26476 + 25d40de commit 08d9357
Show file tree
Hide file tree
Showing 8 changed files with 1,332 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/validate-yml-schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
name: Validate yml schemas

##########################################
# Start the job on PR for all branches #
#########################################

on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
paths:
- "services/**/**/**.yaml"
workflow_dispatch: { }

jobs:
validate-yaml-files:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Get all changed yaml files
id: changed-yaml-files
uses: tj-actions/changed-files@v45
with:
files: |
services/**/**/**.yaml
- name: List all changed yaml files
if: steps.changed-yaml-files.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-yaml-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "File changed: $file"
done
- name: validate yaml files
id: validate-yaml-files
if: steps.changed-yaml-files.outputs.any_changed == 'true'
run: |
python .github/yml-schemas/validate_yml.py "${{ steps.changed-yaml-files.outputs.all_changed_files }}"
167 changes: 167 additions & 0 deletions .github/yml-schemas/defaultAdminActivityLog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$ref": "#/definitions/Welcome",
"definitions": {
"Welcome": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"type": {
"type": "string"
},
"verified": {
"type": "boolean"
},
"visible": {
"type": "boolean"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"properties": {
"$ref": "#/definitions/WelcomeProperties"
},
"references": {
"type": "array",
"items": {
"$ref": "#/definitions/Reference"
}
},
"deployments": {
"type": "array",
"items": {
"$ref": "#/definitions/Deployment"
}
},
"guid": {
"type": "string",
"format": "uuid"
}
},
"required": [
"deployments",
"description",
"guid",
"name",
"properties",
"references",
"tags",
"type",
"verified",
"visible"
],
"title": "Welcome"
},
"Deployment": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"template": {
"type": "string"
},
"type": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"properties": {
"$ref": "#/definitions/DeploymentProperties"
}
},
"required": [
"name",
"properties",
"tags",
"template",
"type"
],
"title": "Deployment"
},
"DeploymentProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"scope": {
"type": "string"
},
"policyScope": {
"type": "string"
},
"documented": {
"type": "boolean"
},
"alertName": {
"type": "string"
}
},
"required": [
"alertName",
"documented",
"policyScope",
"scope"
],
"title": "DeploymentProperties"
},
"WelcomeProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"category": {
"type": "string"
},
"operationName": {
"type": "string"
},
"status": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"category",
"operationName",
"status"
],
"title": "WelcomeProperties"
},
"Reference": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"url": {
"type": "string",
"format": "uri",
"qt-uri-protocols": [
"https"
]
}
},
"required": [
"name",
"url"
],
"title": "Reference"
}
}
}
Loading

0 comments on commit 08d9357

Please sign in to comment.