---
title: "Track Schema Changes Automatically in Your Pull Requests"
description: "Neon's Schema Diff GitHub Action compares the schema of a pull request's Neon child branch against its parent (or a specified base_branch) and posts the result as an SQL patch in a single PR comment."
url: "https://swe.quest/articles/track-schema-changes-automatically-in-your-pull-requests-a44727ec3dcc4112"
canonical: "https://neon.com/blog/track-schema-changes-automatically-in-your-pull-requests"
source: "Neon"
published: "2024-11-28"
difficulty: "medium"
kind: "Announcement"
reading_minutes: 5
tags: ["schema-migrations","ci-cd","postgres"]
---

# Track Schema Changes Automatically in Your Pull Requests

A post on [Neon](https://swe.quest/sources/neon.md), published 2024-11-28, 5 min read, Announcement. Original: [https://neon.com/blog/track-schema-changes-automatically-in-your-pull-requests](https://neon.com/blog/track-schema-changes-automatically-in-your-pull-requests)

## Summary

Neon's Schema Diff GitHub Action compares the schema of a pull request's Neon child branch against its parent (or a specified base\_branch) and posts the result as an SQL patch in a single PR comment. The comment is edited in place on new commits, and nothing is posted when the schemas match. A sample workflow creates a per-PR Neon branch with create-branch-action, runs migrations against it, posts the diff, and deletes the branch when the PR closes. The action also outputs a comment\_url for further automation, such as Slack notifications.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Schema migrations](https://swe.quest/tags/schema-migrations.md) (Data & databases)
- [CI/CD](https://swe.quest/tags/ci-cd.md) (Reliability & operations)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)

## Prerequisites

- GitHub Actions workflows ([easy posts on CI/CD](https://swe.quest/tags/ci-cd.md?difficulty=easy))
- database schema migrations ([easy posts on Databases](https://swe.quest/tags/databases.md?difficulty=easy))

## Keywords

Neon, Schema Diff GitHub Action, GitHub Actions, Neon branches, create-branch-action

## Related posts

- [An API to Track Database Schema Changes](https://swe.quest/articles/an-api-to-track-database-schema-changes-48247d0f7925f89f.md): Neon · 2025-01-09 · Medium · 4 min read · PostgreSQL, Schema migrations, API design, CI/CD, AI agents
  Neon's Schema Diff feature now has a \`compare\_schema\` API endpoint, available on all plans, that takes two Neon branch IDs and returns a unified diff of their Postgres schemas.
- [Neon Twin: How to deploy a change tested in Neon to prod in RDS](https://swe.quest/articles/neon-twin-how-to-deploy-a-change-tested-in-neon-to-prod-in-rds-09282f8f58bccb12.md): Neon · 2024-08-15 · Medium · 10 min read · Schema migrations, PostgreSQL, CI/CD, Deployment
  Schema changes tested on Neon database branches can be promoted to an AWS RDS production Postgres database through GitHub Actions that run when a pull request merges.
- [A database for every preview environment using Neon, GitHub Actions, and Vercel](https://swe.quest/articles/a-database-for-every-preview-environment-using-neon-github-actions-and-vercel-dd5fe24cba2d12b5.md): Neon · 2023-04-14 · Medium · 14 min read · PostgreSQL, CI/CD, Deployment, Schema migrations
  Neon's copy-on-write branching can give every pull request its own production-like Postgres database, avoiding the bottlenecks of shared staging or shared preview databases.
- [Adopting Neon branching in CI/CD pipelines: a practical story by Shepherd](https://swe.quest/articles/adopting-neon-branching-in-ci-cd-pipelines-a-practical-story-by-shepherd-7c4ee09d2fb5431a.md): Neon · 2024-07-11 · Medium · 5 min read · CI/CD, PostgreSQL, Schema migrations, Testing, Serverless
  Shepherd, an insurtech startup that moved its Alchemist pricing engine from SQLite to Postgres, uses Neon's copy-on-write database branches to give every pull request an ephemeral test database.
- [Branching Postgres databases with the Neon API](https://swe.quest/articles/branching-postgres-databases-with-the-neon-api-3faf0de941bc811a.md): Neon · 2022-12-07 · Medium · 3 min read · PostgreSQL, CI/CD, Testing
  Neon branches are copy-on-write clones of a Postgres database that can be created and deleted through the Neon API, giving CI pipelines an isolated copy of production data for end-to-end tests.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
