relational.write
- Improve ConnectionError
#526
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: generate docs for jsonschema | |
on: | |
workflow_dispatch: | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
generate-docs: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
# Setup node for jsonschema to markdown | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 14 | |
- name: Generate resource schema doc | |
run: | | |
cp ./docs/reference/blocks.md /tmp/blocks.md | |
cp ./docs/reference/connection_types.md /tmp/connection_types.md | |
rm -rf ./docs/reference | |
mkdir ./docs/reference | |
nav_order=1 | |
for schema in ./core/src/datayoga_core/resources/schemas/*.schema.json | |
do | |
npx jsonschema2mk --schema ${schema} --extension yaml-examples \ | |
--extension front-matter --fm.parent "Reference" --fm.nav_order "${nav_order}" > \ | |
./docs/reference/$(basename "${schema}" .schema.json).md \ | |
nav_order=$((nav_order+1)) | |
done | |
cp /tmp/blocks.md ./docs/reference/blocks.md | |
cp /tmp/connection_types.md ./docs/reference/connection_types.md | |
- name: Generate connection type schema docs | |
run: | | |
rm -rf ./docs/reference/connection_types | |
mkdir ./docs/reference/connection_types | |
for schema in ./core/src/datayoga_core/resources/schemas/connections/*.schema.json | |
do | |
npx jsonschema2mk --schema ${schema} --extension yaml-examples \ | |
--extension front-matter --fm.parent "Connection Types" --fm.grand_parent "Reference" > \ | |
./docs/reference/connection_types/$(basename "${schema}" .schema.json).md | |
done | |
- name: Generate block schema docs | |
run: | | |
rm -rf ./docs/reference/blocks | |
mkdir ./docs/reference/blocks | |
blocks_dir="./core/src/datayoga_core/blocks" | |
for schema in $(find ${blocks_dir} -name '*.schema.json') | |
do | |
doc_name="$(awk -F/ '{ print $(NF-1) }' <<<${schema}).md" | |
dir="$(echo ${schema} | sed -e s@${blocks_dir}@@)" | |
block_package="$(dirname $(dirname ${dir}))" | |
block_package="$(echo ${block_package} | cut -c2- | sed 's/\//_/g')" | |
[ ! -z "${block_package}" ] && block_package="${block_package}_" | |
npx jsonschema2mk --schema ${schema} --extension yaml-examples \ | |
--extension front-matter --fm.parent "Blocks" --fm.grand_parent "Reference" > \ | |
"./docs/reference/blocks/${block_package}${doc_name}" | |
done | |
- name: Push to repo | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git pull | |
git add . | |
git diff --cached --exit-code || git commit -m "update autogenerated docs" | |
git push |