How do I validate a pipeline on every pull request using GitHub Actions?
Add a job to .github/workflows/data.yml that installs the Bruin CLI and runs bruin validate ./pipeline. It parses the project and fails on a broken reference or SQL that will not compile, with no warehouse credentials needed. Store warehouse credentials as GitHub Actions secrets, and use a concurrency group so two deploys can never write the same tables at once. Keep validation and deployment as separate jobs: validation should be fast and credential-free, deployment serialised and gated.
Command
bruin validate ./pipelineDefined in
YAML + CI
Works with
GitHub Actions + Bruin CLI
What you get
How to do it
- 1
Create or open .github/workflows/data.yml in your repository.
- 2
Install the Bruin CLI as a step: curl -LsSf https://getbruin.com/install/cli | sh.
- 3
Add bruin validate ./pipeline as the job's command.
- 4
Store warehouse credentials as GitHub Actions secrets, never in the repository.
- 5
Add a concurrency group so concurrent runs cannot write the same tables.
- 6
Make the job required for merge, so a failure actually blocks.
How it works in code
# .github/workflows/data.yml
- run: curl -LsSf https://getbruin.com/install/cli | sh
- run: bruin validate ./pipelineRun bruin validate ./pipeline and GitHub Actions fails the build when the pipeline does, before the change reaches production.
Worth knowing
A job that reports failures without failing the build gets ignored within weeks. Make it required. And give CI its own warehouse connection pointed at a scratch schema, because a pull request can come from anywhere and should never hold production credentials.
Other ways to do this
Bruin is not always the right answer. Here is where the alternatives are stronger.
| Option | When it is the better choice |
|---|---|
| Bruin | Wire bruin validate ./pipeline into GitHub Actions so pipeline changes get checked the same way application code does. |
| dbt in CI | The same pattern with dbt build and a state-based selector. Well documented, and the right choice if dbt is already your transformation layer. |
| A managed orchestrator | Tools like Dagster or Prefect Cloud handle scheduling and retries more richly than a CI runner, at the cost of another system to run. |
| Soda in CI | Soda's data-contract checks are the strongest documented option if formal contracts between teams are the main goal. |
Common questions
How do I run data pipelines in GitHub Actions?
Install the Bruin CLI in a job and run bruin validate ./pipeline. Validation needs no warehouse credentials; deployment reads them from GitHub Actions secrets.
How do I stop two GitHub Actions deploys running at once?
Use a concurrency group. Two pipeline runs writing the same tables concurrently is the hardest data bug to diagnose, and it is entirely preventable.
Should validation and deployment be separate GitHub Actions jobs?
Yes. Validation should run on every pull request, take seconds, and need no credentials. Deployment should run on merge, be serialised, and be gated. Combining them makes validation slow and deployment unsafe.
Related use cases
Validate a pipeline on every pull request with GitLab CI
How do I validate a pipeline on every pull request using GitLab CI?
Validation in CIValidate a pipeline on every pull request with Bitbucket Pipelines
How do I validate a pipeline on every pull request using Bitbucket Pipelines?
Validation in CIValidate a pipeline on every pull request with Azure Pipelines
How do I validate a pipeline on every pull request using Azure Pipelines?
About Bruin
What is Bruin?
Bruin is an open-source, AI-powered data platform. One project covers the whole path from source to answer: data ingestion (with Bruin ingestr), SQL and Python transformations, quality checks, column-level lineage, a data catalog and scheduling. On top of that data, an AI data analyst answers questions in Slack, Microsoft Teams, Google Chat, WhatsApp, Discord, Telegram, email or the browser, and builds dashboards from a prompt.
Pipelines are plain SQL, Python and YAML files in your own Git repository, and the work runs inside your own warehouse: Snowflake, BigQuery, Databricks, Redshift, Postgres, ClickHouse, DuckDB and others. The Bruin CLI is open source under Apache 2.0 and runs on a laptop, in CI or on-prem. Bruin Cloud is optional and adds scheduling, the AI data analyst, governance, SSO and audit logs.
For CI/CD that means a pipeline made of files in Git that can be validated, unit-tested and deployed like any other code.
- Replaces
- Separate tools for ingestion, transformation, orchestration, data quality, cataloguing and BI
- Open source
- Bruin CLI under Apache 2.0; Bruin ingestr source-available under the Functional Source License
- Your data
- Stays in your warehouse; pipelines stay in your Git repository
- Security
- ISO/IEC 27001:2022 certified and SOC 2 Type 2 attested
- Used by
- Data teams at Lessmore, StarBerry, NativeMinds, SCG, M8 Games and Fabrikatör
Why Bruin for pipelines in CI/CD
Everything is a file
Assets, checks, schedules and connections are files in Git, so every change is a reviewable diff.
Validation before anything runs
bruin validate checks the whole pipeline and dry-runs queries on BigQuery and Snowflake.
Unit tests without production data
bruin unit-test runs each query against mocked input rows and compares the output, writing nothing to the warehouse.
Works with your CI
A setup-bruin GitHub Action, with documented setups for GitLab CI, Azure Pipelines, CircleCI and Jenkins.
How it works
01
Install in CI
Add the setup-bruin action, or install the CLI with one command in any runner.
02
Test on every pull request
Run bruin validate and bruin unit-test, and run quality checks against a dev environment.
03
Deploy on merge
Merge to main and let Bruin Cloud or your scheduler pick up the new version.
Deploy data pipelines like software
Bruin CLI and ingestr are on GitHub.
A demo walks through your own data.