Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions .github/workflows/check-openapi-json.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Check OpenAPI JSON

on:
workflow_call:

permissions:
contents: write

env:
API_KEY_PREFIX: ${{ secrets.CI_API_KEY_PREFIX }}
API_PORT: ${{ vars.CI_API_V2_PORT }}
API_URL: "http://localhost"
CALCOM_LICENSE_KEY: ${{ secrets.CI_CALCOM_LICENSE_KEY }}
DATABASE_URL: ${{ secrets.CI_DATABASE_URL }}
DATABASE_READ_URL: ${{ secrets.CI_DATABASE_URL }}
DATABASE_WRITE_URL: ${{ secrets.CI_DATABASE_URL }}
JWT_SECRET: ${{ secrets.CI_JWT_SECRET }}
NEXTAUTH_SECRET: ${{ secrets.CI_NEXTAUTH_SECRET }}
NODE_ENV: ${{ vars.CI_NODE_ENV }}
NODE_OPTIONS: --max-old-space-size=4096
REDIS_URL: "redis://localhost:6379"
STRIPE_API_KEY: ${{ secrets.CI_STRIPE_PRIVATE_KEY }}
STRIPE_WEBHOOK_SECRET: ${{ secrets.CI_STRIPE_WEBHOOK_SECRET }}
WEB_APP_URL: "https://app.cal.com"

jobs:
check-openapi-json:
name: Check and update OpenAPI JSON
timeout-minutes: 10
runs-on: blacksmith-2vcpu-ubuntu-2404
steps:
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Checkout PR branch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use the “cache-checkout” action we have

uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 2

- uses: ./.github/actions/yarn-install

- name: Build platform packages
run: |
yarn turbo run build \
--filter=@calcom/platform-constants \
--filter=@calcom/platform-enums \
--filter=@calcom/platform-utils \
--filter=@calcom/platform-types \
--filter=@calcom/platform-libraries \
--filter=@calcom/trpc
- name: Generate OpenAPI JSON
working-directory: apps/api/v2
run: |
yarn prisma generate
yarn generate-swagger
- name: Check and commit OpenAPI JSON changes
env:
IS_FORK: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
run: |
if git diff --exit-code docs/api-reference/v2/openapi.json; then
echo "OpenAPI JSON is up-to-date"
else
echo "OpenAPI JSON has changed"
if [ "$IS_FORK" = "true" ]; then
echo "::error::OpenAPI JSON is out of date. Since this PR is from a fork, automatic commit is not possible."
echo ""
echo "To fix this:"
echo "1. cd apps/api/v2"
echo "2. yarn generate-swagger"
echo "3. Commit the updated docs/api-reference/v2/openapi.json"
exit 1
fi
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docs/api-reference/v2/openapi.json
git commit -m "chore: update openapi.json [skip ci]"
git push
echo "OpenAPI JSON has been automatically updated and committed"
fi
9 changes: 9 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,13 @@ jobs:
uses: ./.github/workflows/check-api-v2-breaking-changes.yml
secrets: inherit

check-openapi-json:
name: Check OpenAPI JSON
needs: [prepare]
if: ${{ needs.prepare.outputs.has-api-v2-changes == 'true' }}
uses: ./.github/workflows/check-openapi-json.yml
secrets: inherit

e2e-api-v2:
name: Tests
needs: [prepare, setup-db]
Expand Down Expand Up @@ -449,6 +456,7 @@ jobs:
unit-test,
api-v2-unit-test,
check-api-v2-breaking-changes,
check-openapi-json,
check-prisma-migrations,
integration-test,
build,
Expand Down Expand Up @@ -489,6 +497,7 @@ jobs:
needs.unit-test.result != 'success' ||
needs.api-v2-unit-test.result != 'success' ||
(needs.prepare.outputs.has-api-v2-changes == 'true' && needs.check-api-v2-breaking-changes.result != 'success') ||
(needs.prepare.outputs.has-api-v2-changes == 'true' && needs.check-openapi-json.result != 'success') ||
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: check-openapi-json failures are only enforced when has-files-requiring-all-checks is true, but that filter excludes docs/**. For docs-only API v2 changes, the OpenAPI check can fail without blocking the required job. Consider enforcing check-openapi-json whenever has-api-v2-changes is true (outside the has-files-requiring-all-checks gate), or include docs in the gate so failures always block merges.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/pr.yml, line 500:

<comment>`check-openapi-json` failures are only enforced when `has-files-requiring-all-checks` is true, but that filter excludes `docs/**`. For docs-only API v2 changes, the OpenAPI check can fail without blocking the required job. Consider enforcing `check-openapi-json` whenever `has-api-v2-changes` is true (outside the `has-files-requiring-all-checks` gate), or include docs in the gate so failures always block merges.</comment>

<file context>
@@ -489,6 +497,7 @@ jobs:
             needs.unit-test.result != 'success' ||
             needs.api-v2-unit-test.result != 'success' ||
             (needs.prepare.outputs.has-api-v2-changes == 'true' && needs.check-api-v2-breaking-changes.result != 'success') ||
+            (needs.prepare.outputs.has-api-v2-changes == 'true' && needs.check-openapi-json.result != 'success') ||
             (needs.prepare.outputs.has-prisma-changes == 'true' && needs.check-prisma-migrations.result != 'success') ||
               needs.build.result != 'success' ||
</file context>
Fix with Cubic

(needs.prepare.outputs.has-prisma-changes == 'true' && needs.check-prisma-migrations.result != 'success') ||
needs.build.result != 'success' ||
needs.build-api-v1.result != 'success' ||
Expand Down
Loading