Corrección de errores en esquemas, completar ejemplos y descripciones #210
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 on contribution | |
on: | |
pull_request: | |
jobs: | |
create-test-matrix: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- id: files | |
continue-on-error: true | |
uses: jitterbit/get-changed-files@v1 | |
with: | |
format: 'json' | |
- id: filter-schema-json | |
if: failure() | |
run: | | |
matrix=$(jq -j '[.[] | select(test("schema.json"))]' <<< '${{ steps.files.outputs.added_modified }}' | sed "s/\"/'/g" | tr -d '\n') | |
echo "::set-output name=matrix::${matrix}" | |
- id: log | |
if: failure() | |
run: | | |
echo ${{ steps.filter-schema-json.outputs.matrix }} | |
outputs: | |
matrix: ${{ steps.filter-schema-json.outputs.matrix }} | |
validate-schemas: | |
needs: create-test-matrix | |
runs-on: ubuntu-latest | |
if: needs.create-test-matrix.outputs.matrix != '[]' | |
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 | |
- 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.check-annotations.outputs.empty == 'false' | |
run: | | |
jq -s '[.[][0]]' ./annotations/**/*-annotation.json > annotations.json | |
- id: logging | |
if: steps.check-annotations.outputs.empty == 'false' | |
run: | | |
cat annotations.json | |
- name: Annotate | |
if: steps.check-annotations.outputs.empty == 'false' | |
uses: yuzutech/annotations-action@v0.3.0 | |
with: | |
repo-token: "${{ secrets.GITHUB_TOKEN }}" | |
input: annotations.json |