Skip to content

ci: run checks only for domains the PR actually changed - #44

Merged
spizeck merged 1 commit into
masterfrom
chore/change-aware-ci
Sep 28, 2026
Merged

spizeck merged 1 commit into
masterfrom
chore/change-aware-ci

Conversation

@spizeck

@spizeck spizeck commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

Makes CI change-aware. A new Detect changes job diffs the PR against the base branch, classifies changed paths into domains, and gates each existing check with a job-level if:. Pushes to master still run the full suite.

Previously a docs/vercel.json-only PR booted both App (Next.js) and Functions (Firebase) — full npm ci + tests + builds that cannot detect a regression from those files.

Required-check safety

The ruleset requires App (Next.js) and Functions (Firebase). Gating uses job-level if:, not workflow paths: filters: a skipped job reports Success and satisfies required checks, whereas a filtered workflow would leave required checks pending forever. Check names stay present on every PR — this PR demonstrates it (only .github/** changed → both jobs skip, checks still resolve).

The classifier fails safe: uncomputable diff or unrecognized path → run everything. Cheap validation added for config-only changes (JSON parse + workflow YAML parse).

Expected behavior

Change App (Next.js) Functions (Firebase)
*.md, docs, .github/**, vercel.json, .devin/** skip skip
src/**, public/**, scripts/**, app configs run skip
functions/**, firebase.json, .firebaserc, firestore.rules, indexes skip run
package.json / package-lock.json / .nvmrc run run
unknown/unmatched file run run
push to master run run

Validation

Classifier logic exercised locally against simulated diffs (vercel-only, docs, app code, functions, lockfile, rules, unknown). Workflow YAML validated.

Generated with Devin

Summary by Sourcery

Make CI change-aware by classifying pull request changes and running only the relevant domain checks while preserving required-check safety and full master-branch coverage.

Enhancements:

  • Make CI selectively run the App and Firebase checks based on the domains affected by a pull request, while retaining full validation for pushes to master.
  • Add fail-safe change classification so unavailable diffs or unknown files trigger all checks, and validate changed JSON and workflow YAML configuration files.

CI:

  • Add a change-detection CI job and gate the existing required checks with job-level conditions so skipped checks still resolve successfully.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @spizeck, this account has used its review budget of 1,500,000 diff characters for the last 7 days.

You can request another review in 22 hours and 45 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@vercel

vercel Bot commented Sep 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
nfl-picks Ignored Ignored Sep 28, 2026 12:23am UTC

Request Review

@sourcery-ai

sourcery-ai Bot commented Sep 28, 2026

Copy link
Copy Markdown

Reviewer's Guide

The workflow now performs a fail-safe, path-based classification of PR changes, validates configuration files cheaply, and conditionally runs the Next.js and Firebase checks at the job level while preserving full CI on pushes to master and maintaining required-check safety.

Flow diagram for change-aware CI checks

flowchart TD
    Event[PR or push event] --> Detect[Detect changes]
    Detect --> Diff[git diff --name-only]
    Diff --> Validate[Validate changed JSON and workflow YAML]
    Validate --> Classify[Classify paths into app and functions outputs]
    Classify --> AppGate{app output is true}
    Classify --> FunctionsGate{functions output is true}
    AppGate -->|yes| App[App Next.js check]
    AppGate -->|no| AppSkip[App check skipped]
    FunctionsGate -->|yes| Functions[Functions Firebase check]
    FunctionsGate -->|no| FunctionsSkip[Functions check skipped]
    Diff -->|diff unavailable or unknown path| Full[Run all domains]
    Event -->|push to master| Full
    Full --> App
    Full --> Functions
Loading

File-Level Changes

Change Details Files
Add a change-detection job that classifies pull-request file paths into application and Firebase Functions domains, with fail-safe full-suite behavior.
  • Fetch the complete repository history and diff the PR head against its base branch.
  • Mark domains based on documented path patterns, treating dependency/runtime changes and unknown or failed diffs as affecting both.
  • Run lightweight JSON parsing and optional workflow YAML validation while classifying changed files.
  • Expose boolean domain outputs for downstream jobs and retain full execution for pushes.
.github/workflows/ci.yml
Gate the existing required CI jobs by their detected domain without removing their check names.
  • Add job dependencies on the detection job.
  • Use job-level conditions so unaffected jobs skip while still resolving required checks successfully.
.github/workflows/ci.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@spizeck
spizeck merged commit b87a679 into master Sep 28, 2026
9 checks passed
@spizeck
spizeck deleted the chore/change-aware-ci branch September 28, 2026 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant