Add Utils And Docs #2
Workflow file for this run
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: Check Schema Util | |
on: | |
pull_request: | |
paths: | |
- 'schemas/**' | |
jobs: | |
check-schema-util: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Get list of modified schema folders | |
id: get_modified_folders | |
run: | | |
MODIFIED_FOLDERS=$(git diff --name-only HEAD~1 HEAD | grep '^schemas/' | cut -d'/' -f2 | sort -u) | |
echo "::set-output name=folders::$MODIFIED_FOLDERS" | |
- name: Run util and check output | |
run: | | |
for folder in ${{ steps.get_modified_folders.outputs.folders }}; do | |
echo "Processing folder: $folder" | |
python utils/convert_schema_to_markdown.py schemas/$folder > schemas/$folder/SCHEMA_TEMP.md | |
if ! diff schemas/$folder/SCHEMA_TEMP.md schemas/$folder/SCHEMA.md; then | |
echo "SCHEMA.md in $folder does not match the expected output." | |
exit 1 | |
fi | |
done | |
env: | |
folders: ${{ steps.get_modified_folders.outputs.folders }} |