Automation

GitHub Actions CI/CD Integration

Automate database drift detection and migration safety preflights directly in your GitHub Pull Requests.

Overview

By integrating DevSync into your GitHub Actions workflow, every pull request automatically scans your codebase schema against staging or production database topologies to catch breaking migration changes before merging.

Workflow Configuration

Example Workflow File

Add the following YAML file to .github/workflows/schema-check.yml:

yaml
name: DevSync Schema Drift Check

on:
  pull_request:
    branches: [ main, develop ]

jobs:
  schema-check:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 20

      - name: Install DevSync CLI
        run: npm install -g @devsync/cli

      - name: Run Read-Only Schema Drift Scan
        env:
          DEVSYNC_API_KEY: ${{ secrets.DEVSYNC_API_KEY }}
          DATABASE_URL: ${{ secrets.STAGING_DATABASE_URL }}
        run: |
          dev-sync scan --check --schema ./prisma/schema.prisma

Key Security Secrets

DEVSYNC_API_KEY: API key created in your DevSync Dashboard under Settings > API Keys.
STAGING_DATABASE_URL: Read-only database connection URL.