Claude-skill-registry cicd-pipeline
CI/CD pipeline guide covering GitHub Actions, Lefthook hooks, Dependabot, and deployment scripts. Use when asking about workflows, automation, or deployment.
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/cicd-pipeline" ~/.claude/skills/majiayu000-claude-skill-registry-cicd-pipeline && rm -rf "$T"
skills/data/cicd-pipeline/SKILL.mdCI/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:
- Local Git Hooks (Lefthook) - Fast pre-commit/pre-push validation
- GitHub Actions - PR quality checks, migrations, deployments
- Dependabot - Automated security updates with auto-merge
- 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/
.github/workflows/| Workflow | Trigger | Purpose |
|---|---|---|
| PR to main/develop | Lint, typecheck, test, build |
| Push to main (*.sql) | Deploy migrations to production |
| Push to dev (*.sql) | Deploy migrations to staging |
| Push to dev (*.sql) | Auto-generate TypeScript types |
| Deployment success | Create Sentry release + sourcemaps |
| Push/PR + weekly schedule | Security vulnerability scanning |
| Dependabot PRs | Auto-merge patch/minor updates |
| Manual | Sync production data to staging |
PR Quality Check (pr-quality-check.yml
)
pr-quality-check.ymlRuns 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
)
deploy-migrations.ymlTriggers 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
)
sync-db-types.ymlAuto-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
lefthook.ymlPre-commit Hooks (< 2 seconds target)
| Hook | Files | Purpose |
|---|---|---|
| *.ts,tsx,json,md... | Prettier auto-fix |
| WIP_*.md | WIP document validation |
| *.sql | Migration syntax check |
| *.sql | RLS security validation |
| *.ts,tsx | Block -v2, -new naming |
| *.json | Detect duplicate keys |
| *.ts,tsx,sql | DB contract validation |
Pre-push Hooks (< 15 seconds default)
| Hook | Purpose |
|---|---|
| Fast lint sanity check |
| Full ESLint (THOROUGH=1 only) |
| Full TypeScript (THOROUGH=1 only) |
| pnpm-lock.yaml sync check |
| DB validation |
| Info 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
.github/dependabot.ymlTarget 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/
.github/actions/setup-node-pnpm
setup-node-pnpmComposite 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/
scripts/CI/CD Related Scripts
| Script | Purpose |
|---|---|
| Local DB contract validation |
| Migration file validation |
| Detect duplicate JSON keys |
| WIP document validation |
| Block forbidden naming patterns |
| RLS security analysis |
Deployment Scripts
| Script | Purpose |
|---|---|
| Manual production deployment |
| Deploy env vars to Vercel |
| Apply migrations to staging |
| Full staging setup |
| Complete staging rebuild |
Utility Scripts
| Script | Purpose |
|---|---|
| Git worktree management |
| Clean trailing newlines from env |
| Deploy email templates |
Environment Configuration
GitHub Secrets Required
| Secret | Description |
|---|---|
| Production project ID |
| Production DB password |
| Supabase management token |
| Staging project ID |
| Staging DB password |
| Sentry release token |
| Sentry organization |
| Sentry project name |
GitHub Variables
| Variable | Description |
|---|---|
| Enable/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
directly, notpsqlsupabase db push - Complex SQL with multiple statements is supported
SASL Authentication Failed:
- Check
secret is correctSUPABASE_DB_PASSWORD - 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
- Verify auto-merge is enabled:
gh repo view --json autoMergeAllowed - Check branch protection rules allow auto-merge
- Ensure CI passes before merge
Security Considerations
- CodeQL runs weekly + on PRs for vulnerability scanning
- Dependabot monitors security advisories
- RLS validation in pre-commit hooks
- No secrets in logs - use GitHub Secrets
- Protected branches require PR reviews
Related Documentation
- Detailed workflow architecture.github/WORKFLOWS.md
- Branch protection setup.github/REPOSITORY_SAFEGUARDS.md
- Overall project guidelinesCLAUDE.md