feat: CI mode with GitHub Actions annotations and --fail-on flag#23
Open
jasdeepkhalsa wants to merge 1 commit into
Open
feat: CI mode with GitHub Actions annotations and --fail-on flag#23jasdeepkhalsa wants to merge 1 commit into
jasdeepkhalsa wants to merge 1 commit into
Conversation
Adds --ci boolean flag and --fail-on=critical|warning|any flag to 'supaforge diff'. In CI mode the command emits GitHub Actions ::error/::warning annotation lines for every drift issue, enabling inline PR comments without any extra tooling. Exit codes: 0=clean, 1=drift above threshold, 2=scan error. Default threshold is 'critical' (matches existing behaviour). Also ships a reusable GitHub Actions workflow template at packages/cli/templates/drift-check.yml.
| */ | ||
| export function formatAnnotation(issue: DriftIssue): string { | ||
| const level = issue.severity === 'critical' ? 'error' : 'warning' | ||
| const title = issue.title.replace(/,/g, '\\,') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds first-class CI support to
supaforge diffvia two new flags:--ci— emits GitHub Actions::error/::warningannotation lines for every drift issue (shows inline on the PR diff view), then outputs a structured JSON summary--fail-on=critical|warning|any— controls the exit code threshold (default:critical, preserving existing behaviour)Also ships a reusable GitHub Actions workflow template at
packages/cli/templates/drift-check.ymlthat teams can drop into their repos with zero additional tooling.Competitive context
Neither pg-delta (Supabase's own alpha) nor migra (the tool Supabase CLI wraps) has GitHub Actions integration. Atlas has it behind a paywall. This makes Supaforge the only free tool with native CI/CD drift detection for Supabase.
New files
packages/cli/src/ci.tsformatAnnotation(),formatGitHubAnnotations(),computeCiExitCode(),formatCiSummary()packages/cli/templates/drift-check.ymlpackages/cli/test/ci.test.tsModified files
packages/cli/src/commands/diff.ts--ciand--fail-onflags; CI mode branch emits annotations, skips preflight/progress, callsthis.exit(exitCode)Exit code semantics
0--fail-onthreshold12GitHub Actions annotation format
For every drift issue, the command writes to stdout:
GitHub Actions picks these up and shows them as inline PR annotations — no extra action needed.
Usage examples
GitHub Actions workflow (template)
Test plan
formatAnnotation— critical →::error, warning/info →::warning%0A, carriage returns as%0D\,(GitHub Actions requirement)formatGitHubAnnotationsreturns one line per issue across all checkscomputeCiExitCodereturns 0 for clean scanstatus: 'error'(error takes precedence over drift)fail-on=critical: 1 on critical, 0 on warning/infofail-on=warning: 1 on critical or warning, 0 on infofail-on=any: 1 on any issue including infocriticalformatCiSummarygroups critical/warning separately, omits infoGenerated by Claude Code