Skip to content

API OpenAPI Sync

API OpenAPI Sync #20

name: API OpenAPI Sync
# This workflow runs weekly to check if the OpenAPI specifications need to be converted
# and ensures the generated code is up to date. It processes algod and indexer in parallel.
on:
schedule:
# Runs every Monday at 9:00 AM UTC
- cron: "0 9 * * 1"
workflow_dispatch:
permissions:
contents: read
jobs:
openapi_conversion:
runs-on: ubuntu-latest
strategy:
matrix:
spec: [algod, indexer, kmd]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-api-tools
- uses: actions/setup-node@v5
with:
node-version: "22"
cache: "npm"
cache-dependency-path: api/package-lock.json
- name: Install api oas converter dependencies
working-directory: api
run: npm ci
- name: Store initial state for ${{ matrix.spec }}
run: git status --porcelain > /tmp/initial_${{ matrix.spec }}_status.txt
- name: Convert ${{ matrix.spec }} OpenAPI specification
run: cargo api convert-${{ matrix.spec }}
- name: Check for ${{ matrix.spec }} changes
run: |
git status --porcelain > /tmp/post_${{ matrix.spec }}_status.txt
if [ -s /tmp/post_${{ matrix.spec }}_status.txt ]; then
echo "❌ ${{ matrix.spec }} OpenAPI sync needed!"
echo "🔧 Run 'cargo api convert-${{ matrix.spec }}' locally and commit"
git diff
exit 1
else
echo "✅ ${{ matrix.spec }} OpenAPI sync passed"
fi