Skip to content

ci: add GitHub Actions workflows #1

ci: add GitHub Actions workflows

ci: add GitHub Actions workflows #1

Workflow file for this run

# Database Migration Workflow

Check failure on line 1 in .github/workflows/database.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/database.yml

Invalid workflow file

(Line: 34, Col: 9): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.DATABASE_URL != ''
#
# This workflow handles database migrations and schema checks.
# It can be used to:
# - Validate database schema changes
# - Run migrations in a test environment
# - Generate migration files
#
# Note: This workflow requires database credentials to be set as GitHub secrets.
# Required secrets:
# - DATABASE_URL: PostgreSQL connection string
name: Database
# Trigger manually or on specific file changes
on:
workflow_dispatch: # Allows manual triggering
push:
branches:
- main
- develop
paths:
- 'config/database/**'
- 'drizzle/**'
- 'drizzle.config.ts'
jobs:
# Validate database schema
validate-schema:
name: Validate Schema
runs-on: ubuntu-latest
# Skip if database URL is not available
if: ${{ secrets.DATABASE_URL != '' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 8
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
# Generate migration files to check for schema changes
- name: Generate migrations
run: pnpm db:generate
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
# Check if there are uncommitted migration files
- name: Check for uncommitted migrations
run: |
if [ -n "$(git status --porcelain drizzle/)" ]; then
echo "⚠️ Uncommitted migration files detected!"
git status
exit 1
else
echo "✅ All migrations are committed"
fi