1
0
Files
Ahmed Bouhuolia be61488952 fix(ci): add MySQL and Redis services for OpenAPI generation
The NestJS app requires database and Redis connections to bootstrap.
Added GitHub Actions services for MySQL and Redis with necessary
environment variables for the openapi:export command to work.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 21:27:24 +02:00

155 lines
4.1 KiB
YAML

name: Generate OpenAPI SDK Types
on:
push:
branches:
- main
- develop
paths:
- 'packages/server/src/**/*.ts'
- 'packages/server/src/**/*.dto.ts'
- '!packages/server/src/**/*.spec.ts'
- '!packages/server/src/**/*.test.ts'
workflow_dispatch:
defaults:
run:
shell: 'bash'
env:
# Database configuration
DB_HOST: 127.0.0.1
DB_USER: root
DB_PASSWORD: root
DB_CHARSET: utf8
SYSTEM_DB_NAME: bigcapital_system
TENANT_DB_NAME_PERFIX: bigcapital_tenant_
# Redis configuration
REDIS_HOST: 127.0.0.1
REDIS_PORT: 6379
# Queue configuration
QUEUE_HOST: 127.0.0.1
QUEUE_PORT: 6379
# App configuration
APP_JWT_SECRET: test-jwt-secret-for-openapi-generation
JWT_SECRET: test-jwt-secret-for-openapi-generation
BASE_URL: http://localhost:3000
# Feature flags
SIGNUP_DISABLED: 'false'
SIGNUP_EMAIL_CONFIRMATION: 'false'
API_RATE_LIMIT: 120,60,600
# Optional services (empty for OpenAPI generation)
MAIL_HOST: ''
MAIL_PORT: ''
MAIL_USERNAME: ''
MAIL_PASSWORD: ''
MAIL_FROM_NAME: ''
MAIL_FROM_ADDRESS: ''
GOTENBERG_URL: ''
GOTENBERG_DOCS_URL: ''
PLAID_CLIENT_ID: ''
PLAID_SECRET: ''
LEMONSQUEEZY_API_KEY: ''
S3_ACCESS_KEY_ID: ''
S3_SECRET_ACCESS_KEY: ''
S3_BUCKET: ''
POSTHOG_API_KEY: ''
STRIPE_PAYMENT_SECRET_KEY: ''
OPEN_EXCHANGE_RATE_APP_ID: ''
BULLBOARD_ENABLED: 'false'
BULLBOARD_USERNAME: ''
BULLBOARD_PASSWORD: ''
jobs:
generate-openapi:
name: Generate OpenAPI and SDK Types
runs-on: ubuntu-latest
timeout-minutes: 15
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: bigcapital_system
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=10
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd="redis-cli ping"
--health-interval=10s
--health-timeout=5s
--health-retries=10
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build shared packages
run: pnpm run build --scope "@bigcapital/utils" --scope "@bigcapital/email-components" --scope "@bigcapital/pdf-templates"
- name: Generate OpenAPI spec and SDK types
run: pnpm run generate:sdk-types
- name: Check for changes
id: check-changes
run: |
if git diff --quiet shared/sdk-ts/; then
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- name: Create Pull Request
if: steps.check-changes.outputs.has_changes == 'true'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'chore(sdk): update OpenAPI spec and generated types'
title: 'chore(sdk): update OpenAPI spec and generated types'
body: |
## Summary
Automated update of OpenAPI specification and generated TypeScript SDK types.
This PR was automatically generated by the `generate-openapi.yml` workflow due to server code changes.
## Changes
- Updated `shared/sdk-ts/openapi.json`
- Regenerated `shared/sdk-ts/src/schema.ts`
## Test plan
- [ ] Verify the generated types compile correctly
- [ ] Check that no breaking changes were introduced to the API types
branch: chore/update-openapi-sdk-types
base: ${{ github.ref_name }}
labels: |
automated
sdk
delete-branch: true