-
-
Notifications
You must be signed in to change notification settings - Fork 734
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/migration_to_3_0
- Loading branch information
Showing
38 changed files
with
863 additions
and
1,323 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Validate case studies structures | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize, ready_for_review] | ||
paths: | ||
- 'config/casestudies/*.yml' | ||
|
||
jobs: | ||
validate: | ||
if: github.event.pull_request.draft == false | ||
name: Validate | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Get changed files | ||
id: changed-files | ||
uses: tj-actions/changed-files@v35 | ||
with: | ||
files: config/casestudies/*.yml | ||
- name: Install ajv and yaml | ||
run: npm install ajv@8.12.0 ajv-formats@2.1.1 yaml@2.2.1 | ||
- name: Run validation script | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const { readFile } = require("fs/promises"); | ||
const Ajv = require("ajv"); | ||
const addFormats = require("ajv-formats"); | ||
const YAML = require("yaml"); | ||
const ajv = new Ajv({ | ||
allErrors: true, | ||
}); | ||
addFormats(ajv); | ||
try { | ||
const schema = await readFile("scripts/casestudies/schema.json", "utf-8"); | ||
const fileNames = `${{steps.changed-files.outputs.all_changed_files}}`.trim().split(" "); | ||
const validate = ajv.compile(JSON.parse(schema)); | ||
for (const fileName of fileNames) { | ||
const study = await readFile(fileName, "utf-8"); | ||
const valid = validate(YAML.parse(study)); | ||
if (valid === true) { | ||
core.info(`${fileName} is valid`); | ||
} else { | ||
core.setFailed(`${fileName} is invalid:`); | ||
core.setFailed(validate.errors); | ||
} | ||
} | ||
} catch (error) { | ||
core.setFailed(error); | ||
} |
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[ | ||
{ | ||
"value": "/tools/generator", | ||
"href": "https://github.com/asyncapi/generator/tree/master/docs" | ||
}, | ||
{ | ||
"value": "reference/specification/", | ||
"href": "https://github.com/asyncapi/spec/blob/master/spec/asyncapi.md" | ||
}, | ||
{ | ||
"value":"/tools/cli", | ||
"href":"https://github.com/asyncapi/cli/tree/master/docs" | ||
}, | ||
{ | ||
"value": "", | ||
"href": "https://github.com/asyncapi/website/blob/master/pages" | ||
} | ||
] |
Oops, something went wrong.