CI integration (advanced)
Keep your diagrams automatically up to date: whenever a stored procedure changes, a CI job runs the
CLI against the changed .sql files and commits the
regenerated diagrams back to the repo alongside the source.
How it works
- The pipeline triggers on a push that touches your procedures folder (e.g.
procs/**.sql). - It installs
bnl-diagramsas a dotnet tool, and works out which.sqlfiles changed in that push. - It runs
bnl-diagramsagainst just those files, writing.mmdoutput into adiagrams/folder. - If anything changed, it commits and pushes the regenerated diagrams back using a bot identity - no manual step required.
Your API key needs to be stored as a secret in your CI system, never committed to the repo - see each sample below for exactly where it goes.
GitHub Actions
Add a repository secret named BNL_DIAGRAMS_API_KEY (Settings → Secrets and
variables → Actions), then add this workflow:
Azure DevOps Pipelines
Add a secret pipeline variable (or variable group) named BNL_DIAGRAMS_API_KEY, and
enable "Allow scripts to access the OAuth token" on the pipeline so the commit-back step can push,
then add this pipeline:
regenerate-diagrams-azure-pipelines.yml
Browsing the results
Once diagrams are committed to your repo on every change, our
diagram viewer template gives you a simple,
searchable way to browse them without needing to open each .mmd file individually.