Skip to content

Fix schema validation issues #408

Fix schema validation issues

Fix schema validation issues #408

Workflow file for this run

# Syncs OpenAPI specs and docs to ReadMe.com on every push to a version branch,
# then generates and deploys static files (sitemap.xml, robots.txt, llms.txt,
# llms-full.txt) to the api.seatable.com vserver via rsync.
#
# Documentation: https://docs.readme.com/docs/rdme or https://github.com/readmeio/rdme
#
# The version is derived from the branch name (e.g. v6.2 -> 6.2).
# The ReadMe category IDs are stored in .github/readme-ids.json (one per branch).
#
# Process for new version:
# 1. git checkout -b vX.Y
# 2. Login to https://dash.readme.com/login and fork the API definition to the new version.
# 3. Get the new category IDs from https://dash.readme.com/project/seatable/vX.Y/reference
# or via API: https://docs.readme.com/main/reference/getcategories
# (use the API key from https://dash.readme.com/project/seatable/vX.Y/api-key as password - username stays empty)
# 4. Update .github/readme-ids.json with the new IDs.
# 5. Update the "category" value in all intro/*.md frontmatter.
# 6. Update the version in all YAML spec files.
# 7. git add . && git commit && git push --set-upstream origin vX.Y
name: Publish
on:
push:
branches:
- "v*"
jobs:
# -----------------------------------------------------------------------
# Job 1: Publish OpenAPI specs and docs to ReadMe.com
# -----------------------------------------------------------------------
publish:
name: Publish to ReadMe
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for oasdiff base branch comparison
- name: Derive version from branch name
run: |
VERSION="${GITHUB_REF_NAME#v}"
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "Deploying version: ${VERSION}"
- name: Read ReadMe IDs from config
run: |
echo "ID_AUTH=$(jq -r '.authentication' .github/readme-ids.json)" >> $GITHUB_ENV
echo "ID_BASE=$(jq -r '.base_operations' .github/readme-ids.json)" >> $GITHUB_ENV
echo "ID_FILE=$(jq -r '.file_operations' .github/readme-ids.json)" >> $GITHUB_ENV
echo "ID_SYSADMIN=$(jq -r '.system_admin_account_operations' .github/readme-ids.json)" >> $GITHUB_ENV
echo "ID_TEAMADMIN=$(jq -r '.team_admin_account_operations' .github/readme-ids.json)" >> $GITHUB_ENV
echo "ID_USER=$(jq -r '.user_account_operations' .github/readme-ids.json)" >> $GITHUB_ENV
echo "ID_PING=$(jq -r '.ping_and_info' .github/readme-ids.json)" >> $GITHUB_ENV
echo "ID_PYTHON=$(jq -r '.python_scheduler' .github/readme-ids.json)" >> $GITHUB_ENV
- name: Check links in docs and specs
uses: lycheeverse/lychee-action@v2
with:
args: "--verbose --no-progress --scheme https --exclude-path 'intro/changelog.md' './intro/*.md' './*.yaml'"
fail: true
- name: Validate OpenAPI specs
run: |
npx --yes swagger-cli validate authentication.yaml
npx --yes swagger-cli validate base_operations.yaml
npx --yes swagger-cli validate file_operations.yaml
npx --yes swagger-cli validate system_admin_account_operations.yaml
npx --yes swagger-cli validate team_admin_account_operations.yaml
npx --yes swagger-cli validate user_account_operations.yaml
npx --yes swagger-cli validate ping_and_info.yaml
npx --yes swagger-cli validate python-scheduler.yaml
- name: Check documentation quality
run: |
pip install pyyaml -q
python3 tests/validate_specs.py --strict
# Breaking change detection: automatically derives the previous version
# branch (e.g. v6.1 compares against v6.0, v6.2 against v6.1).
# Informational only — breaking changes between versions are expected,
# but this makes them visible in the workflow summary.
- name: Check for breaking changes
continue-on-error: true
run: |
# Derive previous version branch: v6.1 -> v6.0, v7.0 -> v6.0
CURRENT="${GITHUB_REF_NAME#v}"
MAJOR="${CURRENT%%.*}"
MINOR="${CURRENT#*.}"
if [ "$MINOR" -gt 0 ]; then
BASE_BRANCH="v${MAJOR}.$((MINOR - 1))"
else
BASE_BRANCH="v$((MAJOR - 1)).0"
fi
echo "Comparing ${GITHUB_REF_NAME} against ${BASE_BRANCH}..."
# Fetch the base branch; skip check if it doesn't exist
if ! git fetch origin "${BASE_BRANCH}" --depth=1 2>/dev/null; then
echo "Base branch ${BASE_BRANCH} not found, skipping breaking change check."
exit 0
fi
# Install oasdiff
go install github.com/tufin/oasdiff@latest
export PATH="$PATH:$(go env GOPATH)/bin"
# Compare each spec file
FOUND=0
for spec in authentication.yaml base_operations.yaml user_account_operations.yaml \
team_admin_account_operations.yaml system_admin_account_operations.yaml \
file_operations.yaml ping_and_info.yaml python-scheduler.yaml; do
echo "--- ${spec} ---"
if git cat-file -e "origin/${BASE_BRANCH}:${spec}" 2>/dev/null; then
git show "origin/${BASE_BRANCH}:${spec}" > "/tmp/base_${spec}"
oasdiff breaking "/tmp/base_${spec}" "${spec}" || FOUND=1
else
echo " (new file, no comparison)"
fi
done
if [ "$FOUND" -eq 1 ]; then
echo "::warning::Breaking changes detected compared to ${BASE_BRANCH} (see above)"
else
echo "No breaking changes detected."
fi
- name: Update SeaTable API docs
uses: readmeio/rdme@v9
with:
rdme: docs ./intro --key=${{ secrets.README_API_KEY }} --version=${{ env.VERSION }}
- name: Update authentication
uses: readmeio/rdme@v9
with:
rdme: openapi authentication.yaml --key=${{ secrets.README_API_KEY }} --id=${{ env.ID_AUTH }} --useSpecVersion
- name: Update base operations
uses: readmeio/rdme@v9
with:
rdme: openapi base_operations.yaml --key=${{ secrets.README_API_KEY }} --id=${{ env.ID_BASE }} --useSpecVersion
- name: Update file operations
uses: readmeio/rdme@v9
with:
rdme: openapi file_operations.yaml --key=${{ secrets.README_API_KEY }} --id=${{ env.ID_FILE }} --useSpecVersion
- name: Update sys admin account operations
uses: readmeio/rdme@v9
with:
rdme: openapi system_admin_account_operations.yaml --key=${{ secrets.README_API_KEY }} --id=${{ env.ID_SYSADMIN }} --useSpecVersion
- name: Update team admin account operations
uses: readmeio/rdme@v9
with:
rdme: openapi team_admin_account_operations.yaml --key=${{ secrets.README_API_KEY }} --id=${{ env.ID_TEAMADMIN }} --useSpecVersion
- name: Update user account operations
uses: readmeio/rdme@v9
with:
rdme: openapi user_account_operations.yaml --key=${{ secrets.README_API_KEY }} --id=${{ env.ID_USER }} --useSpecVersion
- name: Update ping & info
uses: readmeio/rdme@v9
with:
rdme: openapi ping_and_info.yaml --key=${{ secrets.README_API_KEY }} --id=${{ env.ID_PING }} --useSpecVersion
- name: Update python scheduler
uses: readmeio/rdme@v9
with:
rdme: openapi python-scheduler.yaml --key=${{ secrets.README_API_KEY }} --id=${{ env.ID_PYTHON }} --useSpecVersion
# -----------------------------------------------------------------------
# Job 2: Generate and deploy static files to vserver
# -----------------------------------------------------------------------
deploy-static:
name: Deploy static files
runs-on: ubuntu-latest
needs: publish
steps:
- name: Check out repo
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for git lastmod in sitemap
- name: Install Python dependencies
run: pip install pyyaml
- name: Generate sitemap.xml, llms.txt, llms-full.txt
run: python3 custom-domain/generate.py
- name: Validate sitemap.xml
run: python3 -c "import xml.etree.ElementTree as ET; ET.parse('custom-domain/output/sitemap.xml'); print('sitemap.xml is valid XML')"
- name: Copy static files to output
run: cp custom-domain/robots.txt custom-domain/sitemap.xsl custom-domain/output/
- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
- name: Deploy to vserver
run: "rsync -avz --delete . ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:"
working-directory: custom-domain/output