DEVOPS

Flag merged BigQuery queries over budget and open a Linear tuning task

When a PR merges, scans changed SQL for BigQuery queries whose dry-run cost exceeds your byte budget and opens a Linear task with the offending diff and a dry-run estimate.

CategoryDevOps
Enginesim
Difficultyintermediate
Triggerevent
Steps5
Setup~15 min

How it runs

The automated pipeline, trigger to output.

  • TriggerGitHub pull request mergedGitHubGitHub
  • ActionFetch diff and filter changed .sql filesGitHubGitHub
  • ActionDry-run each query to estimate bytes scannedGoogle BigQueryBigQuery
  • LogicKeep only queries over the byte budget
  • OutputOpen Linear tuning task with diff and estimateLinearLinear

What it does

Every merged pull request becomes a cost gate. The flow pulls the SQL files changed in the merge, runs each query as a BigQuery dry run to estimate bytes scanned, and compares that against a configured budget. Any query over budget gets a Linear task containing the exact diff, the estimated cost, and the PR link so an engineer can tune it before it runs at scale.

When to use it

Use it when analytics or pipeline SQL ships through GitHub and you keep getting surprised by expensive on-demand queries after merge. It catches regressions at the moment they land, not weeks later on the bill.

How it works

  1. 1A GitHub pull request merged event fires the flow.
  2. 2The flow fetches the diff and filters to changed .sql files.
  3. 3Each query runs as a BigQuery dry run to read estimated bytes processed.
  4. 4A logic step keeps only queries above the byte budget.
  5. 5For each offender, a Linear issue is created with the diff snippet, the dry-run estimate, and the PR URL, labeled for the data platform team.

Set it up

What you configure once, before turning it on.

  1. 1
    Connect GitHubRepos, issues, pull requests, actions.
  2. 2
    Connect BigQueryDatasets, queries, schemas.
  3. 3
    Connect LinearIssues, projects, cycles, triage.
  4. 4
    Set each agent's modelWe leave models unset so you pick the tier — fast + cheap, or top-quality.
  5. 5
    Tune it to your dataEdit the prompts, filters, and field mappings so it matches how your team works.
  6. 6
    Test, then turn it onRun once against a sample, confirm the output, then enable the trigger.

Run this workflow in your colony.

14-day trial. No DevOps. No Sales call. Provisioned in under a minute.