Quick setup checklist when creating a new repo from this template.
Settings → Branches → Add branch protection rule for main:
- ✅ Require pull request before merging
- ✅ Require status checks to pass (after first successful CI run)
- ✅ Require branches to be up to date before merging
Settings → Actions → General:
- ✅ Allow all actions and reusable workflows (required for workflows to run)
- OR: Allow specific actions (if your org requires it)
Note: This template uses GitHub-hosted runners (ubuntu-latest). GitHub provides and manages these automatically.
Important: If this is a public repository, protect your secrets and workflows from unauthorized use.
Settings → Actions → General → Fork pull request workflows from outside collaborators:
- ✅ Require approval for all outside collaborators (most secure, recommended)
- OR: Require approval for first-time contributors
Why this matters:
- Workflows have access to secrets like
DUNE_API_KEY - Protect team account from unnecessary workflow runs which consume credits
- This setting requires a maintainer to manually approve workflow runs from non-org members
Note: This only affects public repositories. Private repos automatically restrict workflow access to org members.
Settings → Secrets and variables → Actions → Secrets
| Secret Name | Description | How to Get |
|---|---|---|
DUNE_API_KEY |
Your Dune API key | dune.com/settings/api |
Settings → Secrets and variables → Actions → Variables
| Variable Name | Description | Example |
|---|---|---|
DUNE_TEAM_NAME |
Your Dune team name | your_team |
Note: If not set, DUNE_TEAM_NAME defaults to 'dune'.
name: 'your_project_name' # Change from 'dbt_template'
profile: 'your_project_name'your_project_name: # Match the profile name above
target: dev
outputs:
dev:
# ... rest stays the sameAdd to your shell profile (recommended):
# For zsh (default on macOS)
echo 'export DUNE_API_KEY=your_actual_api_key' >> ~/.zshrc
echo 'export DUNE_TEAM_NAME=your_team_name' >> ~/.zshrc
echo 'export DEV_SCHEMA_SUFFIX=your_name' >> ~/.zshrc # Optional
source ~/.zshrc
# For bash
echo 'export DUNE_API_KEY=your_actual_api_key' >> ~/.bashrc
echo 'export DUNE_TEAM_NAME=your_team_name' >> ~/.bashrc
echo 'export DEV_SCHEMA_SUFFIX=your_name' >> ~/.bashrc # Optional
source ~/.bashrc
# For fish
echo 'set -x DUNE_API_KEY your_actual_api_key' >> ~/.config/fish/config.fish
echo 'set -x DUNE_TEAM_NAME your_team_name' >> ~/.config/fish/config.fish
echo 'set -x DEV_SCHEMA_SUFFIX your_name' >> ~/.config/fish/config.fish # Optional
source ~/.config/fish/config.fishOr export for current session:
export DUNE_API_KEY=your_actual_api_key
export DUNE_TEAM_NAME=your_team_name
export DEV_SCHEMA_SUFFIX=your_name # Optional# Install dependencies
uv sync
# Install dbt packages
uv run dbt deps
# Test connection
uv run dbt debug
# Run template models (optional - you can delete these)
uv run dbt run
uv run dbt testThe models/templates/ directory contains example models. You can:
Option A - Keep as reference: Keep the files but don't run them (they're examples)
Option B - Remove:
rm -rf models/templates/Then create your own models in models/.
To receive CI/CD failure emails:
- Profile → Settings → Notifications → Actions
- Select: "Notify me for failed workflows only"
- Verify your email address
- Watch this repository (any level works)
Cursor AI rules in .cursor/rules/ are optional guidelines:
dbt-best-practices.mdcis committed (team-wide)sql-style-guide.mdcis gitignored (personal preference)
Modify dbt-best-practices.mdc to fit your team's needs, or remove if not using Cursor.
Create a test PR to verify CI workflow:
git checkout -b test-setup
# Make a small change
git commit -am "Test CI setup"
git push origin test-setup
# Create PR on GitHubVerify:
- ✅ CI workflow runs
- ✅ No secret/variable errors
- ✅ Models run successfully
- ✅ Tests pass
The production workflow is disabled by default to prevent automatic runs on new repos.
When you're ready for hourly production runs:
Edit .github/workflows/dbt_prod.yml:
on:
schedule:
- cron: '0 * * * *' # Uncomment these lines
workflow_dispatch:Before enabling:
- ✅ CI tests are passing
- ✅ You've tested production runs manually (Actions → dbt prod orchestration → Run workflow)
- ✅ You understand this will run every hour and consume GitHub Actions minutes
If CI fails with "Secret not found":
- Double-check secret name matches exactly:
DUNE_API_KEY - Secrets are case-sensitive
- Make sure secret is set at repository level (not environment)
If schema errors:
- Verify
DUNE_TEAM_NAMEvariable is set - Check that your Dune team name matches exactly
To receive template updates and improvements, set up upstream tracking to the original template repository.
Add upstream remote:
git remote add upstream https://github.com/YOUR_ORG/dune-dbt-template.git
git fetch upstreamTo pull in template updates later:
git fetch upstream
git checkout main
git merge upstream/main
# Resolve any conflicts
git push origin mainWhy do this?
- ✅ Get bug fixes and improvements from the template
- ✅ Receive new features and optimizations
- ✅ Stay aligned with best practices updates
Note: Only merge updates that make sense for your project. Review changes carefully before merging.
Once setup is complete:
- Read Getting Started
- Review Development Workflow
- Check dbt Best Practices
- Start building your models!
- See Troubleshooting for common issues
- Check CI/CD for GitHub Actions details