Validate schemas nightly #1224
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 schemas nightly | |
on: | |
schedule: | |
# every night at one | |
- cron: '0 1 * * *' | |
workflow_dispatch: | |
jobs: | |
create-test-matrix: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- id: list-schema-files | |
run: | | |
echo "::set-output name=matrix::$(jq -ncR '[inputs]' <<< $(find . -print | grep -i 'schema.json'))" | |
outputs: | |
matrix: ${{ steps.list-schema-files.outputs.matrix }} | |
validate-schemas: | |
needs: create-test-matrix | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
schema-file: ${{ fromJson(needs.create-test-matrix.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v2 | |
name: Checkout | |
- id: get-folder | |
run: | | |
echo "::set-output name=folder::$(basename $(dirname ${{ matrix.schema-file }}))" | |
- uses: wistefan/validate-data-model@master | |
id: validate | |
name: Validate | |
with: | |
schema-file: ${{ matrix.schema-file }} | |
failure-file: ${{ steps.get-folder.outputs.folder }}-failure.json | |
annotations-file: ${{ steps.get-folder.outputs.folder }}-annotation.json | |
- if: failure() | |
id: doc | |
run: | | |
ls -R | |
- name: Upload failure report | |
if: failure() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Schema-${{ steps.get-folder.outputs.folder }} | |
path: ${{ steps.get-folder.outputs.folder }}-failure.json | |
if-no-files-found: ignore | |
- name: Upload annotations | |
if: failure() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Schema-${{ steps.get-folder.outputs.folder }} | |
path: ${{ steps.get-folder.outputs.folder }}-annotation.json | |
if-no-files-found: ignore | |
report: | |
needs: validate-schemas | |
runs-on: ubuntu-latest | |
if: always() | |
steps: | |
- uses: actions/checkout@v2 | |
name: Checkout | |
- uses: actions/download-artifact@v2 | |
with: | |
path: annotations | |
- id: check-annotations | |
run: | | |
.github/check-folder-empty.sh | |
- id: prepare-annotations | |
if: steps.get-folder.outputs.empty == 'false' | |
run: | | |
jq -s '[.[][0]]' ./annotations/**/*-annotation.json > annotations.json | |
- id: logging | |
if: steps.get-folder.outputs.empty == 'false' | |
run: | | |
cat annotations.json | |
- name: Annotate | |
if: steps.get-folder.outputs.empty == 'false' | |
uses: yuzutech/annotations-action@v0.3.0 | |
with: | |
repo-token: "${{ secrets.GITHUB_TOKEN }}" | |
input: annotations.json |