Run your dbt Cloud production job on every merge to main

Every time a pull request merges into main, we kick off your dbt Cloud production job so your warehouse always reflects the exact code that just shipped.

Deterministic Code
dbt CloudGitHubEngineeringOperationsData Sync
PromptCreate

Whenever a pull request is merged into the default branch (main) of my GitHub repository, run my dbt Cloud production deployment job so the warehouse rebuilds from exactly the code that just landed. This is a deterministic code workflow: one GitHub merge comes in, one dbt Cloud run goes out, with no branching logic.

Trigger on GitHub pull request webhooks. Only proceed when the pull request was actually merged into main: the event is a pull_request event whose action is closed, whose merged flag is true, and whose base branch is the repository's default branch (main). Ignore pull requests that were closed without merging, and ignore merges into any other branch, so the job only runs on genuine deployments to main.

When a qualifying merge fires, call the dbt Cloud Trigger Job Run operation to kick off the configured production job, using the dbt Cloud account id and the production job id. Pass a cause message that references the merged pull request number and the merged commit SHA, for example 'Deploy: merged PR #<number> at <commit sha>', so every run is traceable back to the change that triggered it.

Pin the run to the merged code by passing the merged commit SHA as the run's git_sha override (the pull request's merge commit SHA), and optionally set git_branch to main, so dbt Cloud builds exactly that commit rather than whatever happens to be latest on the branch. Trigger the run and finish; there is no follow-up polling or notification step.

What does this prompt do?

  • Watches your GitHub repository and springs into action the moment a pull request is merged into your main branch.
  • Automatically starts your dbt Cloud production deployment job so your data models rebuild from the exact code that just landed.
  • Ignores pull requests that were closed without merging and merges into other branches, so the job only runs on real deployments to main.
  • Records the pull request number and commit behind each run, so every deployment traces back to the change that triggered it.

What do I need to use this?

  • A GitHub repository where your team merges pull requests into a main branch.
  • A dbt Cloud account with a production deployment job already set up.
  • Permission to connect both your GitHub repository and your dbt Cloud account to General Input.

How can I customize it?

  • Point it at a different branch, like production or release, instead of main.
  • Choose which dbt Cloud job runs, for example a full build versus a lighter refresh.
  • Adjust the note attached to each run so it shows the pull request number and commit the way your team prefers.

FAQs

Will this run every time I close a pull request?
No. It only fires when a pull request is actually merged into your main branch. Pull requests you close without merging are ignored.
Does it build the exact code that was merged?
Yes. We pass the merged commit to dbt Cloud so the run builds precisely the code that just landed on main, not whatever happens to be latest on the branch.
What if I merge into a branch other than main?
Merges into other branches are ignored by default. You can change which branch it watches when you set it up.
Do I need to write any code?
No. You connect your GitHub repository and dbt Cloud account, pick the job to run, and the workflow handles the rest.
Can I use my existing dbt Cloud production job?
Yes. It runs a job you already have configured in dbt Cloud, so there is no need to rebuild your deployment setup.

Related templates

Open a Heroku release war room the moment production looks wrong

See every recent deploy across all your Heroku apps in one timeline, then roll back, restart, or file an incident without leaving the screen.

Heroku
GitHub
Linear
App
See what Hacker News really thinks of the tools in your stack

Every tool you run or are weighing up, with the Hacker News threads that actually mattered, project health beside them, and a written verdict you keep.

Hacker News
GitHub
Notion
+1
App
See and fix Terraform variable drift across every workspace

One matrix that shows every workspace variable side by side, flags what is missing or mismatched, and fixes it only after you approve each change.

HCP Terraform (Terraform Cloud)
GitHub
App
A docs coverage board that catches what shipped undocumented

See everything engineering shipped next to the docs pages that cover it, so the work nobody labelled stops slipping through.

GitBook
GitHub
Slack Bot
App
A technology radar board your architecture group works out of

Every library you have adopted, are trialing, are assessing or have put on hold, on one board, with live research and a written recommendation on each card.

Context7
GitHub
Notion
App
Take-home review desk that runs candidate code in a sandbox

See every take-home waiting on a verdict, read the code in the app, and have it built and tested in a throwaway machine instead of on your laptop.

Daytona
Greenhouse
GitHub
+1
App

Ship to production the moment code merges.

Connect GitHub and dbt Cloud once, and every merge to main kicks off your production build automatically.