Skip to content
cicd-pipeline logo

CI/CD Pipeline Skill

cicd-pipeline

CI/CD pipeline guide covering GitHub Actions, Lefthook hooks, Dependabot, and deployment scripts. Use when asking about workflows, automation, or deployment.

SKILL.md

Full skill instructions

CI/​CD Pipeline Skill

Comprehensive guide to Ballee's CI/​CD infrastructure including GitHub Actions, git hooks, scripts, and deployment processes.

Overview

Ballee uses a multi-layered CI/​CD approach:

  1. Local Git Hooks (Lefthook) - Fast pre-commit/​pre-push validation
  2. GitHub Actions - PR quality checks, migrations, deployments
  3. Dependabot - Automated security updates with auto-merge
  4. Vercel - Production/​staging deployments (automatic)

Branch Strategy

main     → Production (protected, requires PR + Quality Gate)
dev      → Development/​Staging (Dependabot target)
feat/​*   → Feature branches (via git worktrees)
fix/​*    → Bug fix branches

Workflow: feat/​branch → PR to dev → PR to main → Production


GitHub Actions Workflows

Location: .github/​workflows/

WorkflowTriggerPurpose
pr-quality-check.ymlPR to main/​developLint, typecheck, test, build
deploy-migrations.ymlPush to main (*.sql)Deploy migrations to production
deploy-staging-migrations.ymlPush to dev (*.sql)Deploy migrations to staging
sync-db-types.ymlPush to dev (*.sql)Auto-generate TypeScript types
sentry-release.ymlDeployment successCreate Sentry release + sourcemaps
codeql.ymlPush/​PR + weekly scheduleSecurity vulnerability scanning
dependabot-auto-merge.ymlDependabot PRsAuto-merge patch/​minor updates
sync-prod-data-to-staging.ymlManualSync production data to staging

PR Quality Check (pr-quality-check.yml)

Runs on PRs targeting main or develop:

Jobs:
  1. detect-changes    # Smart change detection
  2. oxlint           # Fast lint (~1 min) - fail-fast
  3. lint             # Full ESLint
  4. typecheck        # TypeScript validation
  5. test             # Unit + integration tests
  6. build            # Production build verification
  7. quality-gate     # Final approval status

Key Features:

  • Cancels in-progress runs on new commits
  • Skips irrelevant jobs based on changed files
  • Parallel execution for speed

Migration Deployment (deploy-migrations.yml)

Triggers on push to main with SQL changes:

Steps:
  1. Validate migration files (no duplicates)
  2. Check pending migrations
  3. Apply via psql (supports complex SQL)
  4. Generate TypeScript types
  5. Create PR with type updates

Connection: Uses Supabase pooler (IPv4) for GitHub Actions compatibility

Database Type Sync (sync-db-types.yml)

Auto-generates TypeScript types after migration changes:

Trigger: Push to dev with *.sql changes
Output:
  - packages/​supabase/​src/​database.types.ts
  - apps/​web/​lib/​database.types.ts

Local Git Hooks (Lefthook)

Configuration: lefthook.yml

Pre-commit Hooks (< 2 seconds target)

HookFilesPurpose
format*.ts,tsx,json,md...Prettier auto-fix
validate-wipWIP_*.mdWIP document validation
validate-migrations*.sqlMigration syntax check
validate-rls-policies*.sqlRLS security validation
check-version-suffixes*.ts,tsxBlock -v2, -new naming
validate-json-keys*.jsonDetect duplicate keys
validate-db-local*.ts,tsx,sqlDB contract validation

Pre-push Hooks (< 15 seconds default)

HookPurpose
oxlintFast lint sanity check
lintFull ESLint (THOROUGH=1 only)
typecheckFull TypeScript (THOROUGH=1 only)
validate-lockfilepnpm-lock.yaml sync check
validate-db-localDB validation
validate-db-typesInfo about auto-sync

Usage

# Normal push (fast, ~15s)
git push

# Thorough push (full checks, ~5min)
THOROUGH=1 git push

# Skip hooks (emergency only)
git push --no-verify

# Skip specific hook
LEFTHOOK_EXCLUDE=check-version-suffixes git commit -m "..."

Dependabot Configuration

Location: .github/​dependabot.yml

Target Branch: dev
Schedule: Weekly (Monday 06:00 Europe/​Zurich)

Ecosystems:
  - npm (security updates only)
  - github-actions (all updates)

Auto-merge Workflow

# .github/​workflows/​dependabot-auto-merge.yml
Behavior:
  - Patch/​Minor: Auto-approve + auto-merge
  - Major: Comment notification, manual review required

Reusable Actions

Location: .github/​actions/

setup-node-pnpm

Composite action for consistent Node.js setup:

uses: ./​.github/​actions/​setup-node-pnpm
with:
  node-version: '20'        # Default
  install-dependencies: 'true'
  cache-turbo: 'false'
  cache-nextjs: 'false'

Features:

  • pnpm v10.14.0 setup
  • Node.js with pnpm cache
  • Optional Turbo/​Next.js caching
  • Frozen lockfile install

Scripts

Location: scripts/

CI/​CD Related Scripts

ScriptPurpose
validate-db-local.shLocal DB contract validation
validate-migrations.shMigration file validation
validate-json-keys.shDetect duplicate JSON keys
validate-wip.shWIP document validation
check-version-suffixes.shBlock forbidden naming patterns
analyze-rls-policies.shRLS security analysis

Deployment Scripts

ScriptPurpose
deploy-production.shManual production deployment
deploy-env-vars.shDeploy env vars to Vercel
apply-staging-migrations.shApply migrations to staging
setup-staging-environment.shFull staging setup
setup-complete-staging.shComplete staging rebuild

Utility Scripts

ScriptPurpose
git-worktree.shGit worktree management
clean-env-vars.shClean trailing newlines from env
update-supabase-email-templates.shDeploy email templates

Environment Configuration

GitHub Secrets Required

SecretDescription
SUPABASE_PROJECT_IDProduction project ID
SUPABASE_DB_PASSWORDProduction DB password
SUPABASE_ACCESS_TOKENSupabase management token
STAGING_SUPABASE_PROJECT_IDStaging project ID
STAGING_SUPABASE_DB_PASSWORDStaging DB password
SENTRY_AUTH_TOKENSentry release token
SENTRY_ORGSentry organization
SENTRY_PROJECTSentry project name

GitHub Variables

VariableDescription
ENABLE_DB_TYPE_SYNCEnable/​disable type sync (default: true)

Vercel Deployment

Handled automatically by Vercel GitHub integration:

Push to dev  → Staging deployment (preview)
Push to main → Production deployment

Environment Variables: Managed via Vercel dashboard or vercel env CLI


Common Commands

Manual Workflow Triggers

# Deploy migrations to production
gh workflow run deploy-migrations.yml --ref main

# Deploy migrations to staging
gh workflow run deploy-staging-migrations.yml --ref dev

# Force regenerate DB types
gh workflow run sync-db-types.yml --ref dev -f force=true

# Create Sentry release
gh workflow run sentry-release.yml -f environment=production

# Sync prod data to staging
gh workflow run sync-prod-data-to-staging.yml

View Workflow Status

# List recent runs
gh run list

# View specific run
gh run view <run-id>

# Watch run in progress
gh run watch

Troubleshooting

Migration Deployment Fails

IPv6 Connection Error:

  • Workflows use IPv4 pooler (aws-1-eu-central-1.pooler.supabase.com)
  • Already configured, but check if Supabase changed endpoints

Prepared Statement Error:

  • Workflows use psql directly, not supabase db push
  • Complex SQL with multiple statements is supported

SASL Authentication Failed:

  • Check SUPABASE_DB_PASSWORD secret is correct
  • Verify using port 5432 (session mode) not 6543 (transaction mode)

Pre-push Hook Slow

# Use fast mode (default)
git push

# Only use thorough mode when needed
THOROUGH=1 git push

Lefthook Not Running

# Reinstall hooks
lefthook install

# Check installation
lefthook run pre-commit

Dependabot Not Auto-merging

  1. Verify auto-merge is enabled: gh repo view --json autoMergeAllowed
  2. Check branch protection rules allow auto-merge
  3. Ensure CI passes before merge

Security Considerations

  1. CodeQL runs weekly + on PRs for vulnerability scanning
  2. Dependabot monitors security advisories
  3. RLS validation in pre-commit hooks
  4. No secrets in logs - use GitHub Secrets
  5. Protected branches require PR reviews

Related Documentation

  • .github/​WORKFLOWS.md - Detailed workflow architecture
  • .github/​REPOSITORY_SAFEGUARDS.md - Branch protection setup
  • CLAUDE.md - Overall project guidelines

More DevOps & CI/CD skills

Project scaffolding, deployment configuration, and CI/CD setup for Google ADK agents.

6K 472.6K
View

Set up tracing, logging, and monitoring for deployed ADK agents across Cloud Trace, BigQuery, and third-party platforms.

6K 472.6K
View

Enterprise Azure infrastructure architect generating Bicep or Terraform from workload descriptions.

1.5K 454.3K
View
azure-kubernetes logo
DevOps & CI/CD

azure-kubernetes

Plan and configure production-ready Azure Kubernetes Service clusters with Day-0 and Day-1 best practices.

1.5K 447.1K
View

Raw mechanical interfaces fusing Swiss typographic print with military terminal aesthetics. Rigid grids, extreme type scale contrast, utilitarian color, analog degradation effects. For data-heavy dashboards, portfolios, or editorial sites that need to feel like declassified blueprints.

92.7K 354.9K
View
just-scrape logo
DevOps & CI/CD

just-scrape

Web search, scraping, extraction, crawling, and monitoring via ScrapeGraph AI CLI.

69 245K
View

Skill for working with Firebase Hosting (Classic). Use this when you want to deploy static web apps, Single Page Apps (SPAs), or simple microservices. Do NOT use for Firebase App Hosting.

462 159.7K
View

Deploy and manage web apps with Firebase App Hosting. Use this skill when deploying Next.js/Angular apps with backends.

462 159.1K
View
deploy-to-vercel logo
DevOps & CI/CD

deploy-to-vercel

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

31.9K 146.6K
View
programmatic-seo logo
DevOps & CI/CD

programmatic-seo

Build SEO-optimized pages at scale using templates, data, and proven playbook patterns.

53.3K 140.1K
View

Design and build isolated, reusable Convex backend components with clear boundaries and app-facing wrappers.

63 123.5K
View

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".

31.9K 116.1K
View

Coding & apps AI tools

Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View
Imagica logo
Coding & apps

Imagica

Build a no-code AI app in minutes.

Freemium
View
E
Coding & apps

Emergent.sh

An IDE for code migration from legacy to modern frameworks through coding agents.

Freemium
View
Wonder Dynamics logo
Coding & apps

Wonder Dynamics

Automate CGI animation in live-action scenes

Paid
View
M
Coding & apps

Mixo

Launch a website in seconds with AI.

Paid
View
AI Code Convert logo
Coding & apps

AI Code Convert

Streamline Your Coding Experience with AI Code Helper

Free
View