Implementation:TobikoData Sqlmesh GithubCICDBotConfig Init
| Knowledge Sources | |
|---|---|
| Domains | Data_Engineering, CICD |
| Last Updated | 2026-02-07 00:00 GMT |
Overview
Concrete configuration class for controlling GitHub CI/CD bot behavior in data transformation deployments provided by SQLMesh.
Description
The GithubCICDBotConfig class is a Pydantic-based configuration model that defines all behavioral parameters for the SQLMesh GitHub CI/CD bot. It validates configuration at initialization time, ensures dependent fields are properly set, provides sensible defaults, and exposes properties for accessing derived configuration values. The class enables declarative control over deployment workflows, approval gates, environment naming, and data loading strategies.
Usage
Use GithubCICDBotConfig when configuring SQLMesh CI/CD bot behavior in GitHub Actions workflows. This configuration is typically defined in the SQLMesh project's config.yaml file under the cicd_bot section and loaded automatically by the bot controller during workflow execution.
Code Reference
Source Location
- Repository: sqlmesh
- File: sqlmesh/integrations/github/cicd/config.py:L19-96
Signature
class GithubCICDBotConfig(BaseConfig):
type_: t.Literal["github"] = Field(alias="type", default="github")
invalidate_environment_after_deploy: bool = True
enable_deploy_command: bool = False
merge_method: t.Optional[MergeMethod] = None
command_namespace: t.Optional[str] = None
auto_categorize_changes_: t.Optional[CategorizerConfig] = Field(
default=None, alias="auto_categorize_changes"
)
default_pr_start: t.Optional[TimeLike] = None
skip_pr_backfill_: t.Optional[bool] = Field(default=None, alias="skip_pr_backfill")
pr_include_unmodified_: t.Optional[bool] = Field(default=None, alias="pr_include_unmodified")
run_on_deploy_to_prod: bool = False
pr_environment_name: t.Optional[str] = None
pr_min_intervals: t.Optional[int] = None
prod_branch_names_: t.Optional[str] = Field(default=None, alias="prod_branch_name")
forward_only_branch_suffix_: t.Optional[str] = Field(
default=None, alias="forward_only_branch_suffix"
)
check_if_blocked_on_deploy_to_prod: bool = True
Import
from sqlmesh.integrations.github.cicd.config import GithubCICDBotConfig, MergeMethod
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| type_ | Literal["github"] | No | Bot type identifier (defaults to "github") |
| invalidate_environment_after_deploy | bool | No | Whether to mark PR environment for cleanup after deployment (default: True) |
| enable_deploy_command | bool | No | Whether production deployment requires explicit /deploy comment (default: False) |
| merge_method | MergeMethod | No | PR merge strategy: MERGE, SQUASH, or REBASE (required if enable_deploy_command=True) |
| command_namespace | str | No | Prefix for bot commands in PR comments |
| auto_categorize_changes | CategorizerConfig | No | Configuration for automatic breaking/non-breaking change detection |
| default_pr_start | TimeLike | No | Starting date boundary for PR environment data loading |
| skip_pr_backfill | bool | No | Whether to skip loading historical data in PR environments (defaults to True with deprecation warning) |
| pr_include_unmodified | bool | No | Whether to include unmodified models in PR plans (default: False) |
| run_on_deploy_to_prod | bool | No | Whether to execute run tests on production deployment (default: False) |
| pr_environment_name | str | No | Custom prefix for PR environment naming |
| pr_min_intervals | int | No | Minimum number of intervals to load for PR environments |
| prod_branch_names | str | No | Branch name that triggers production deployments (defaults to ["main", "master"]) |
| forward_only_branch_suffix | str | No | Branch suffix indicating forward-only deployment (default: "-forward-only") |
| check_if_blocked_on_deploy_to_prod | bool | No | Whether to enforce branch protection before deployment (default: True) |
Outputs
| Name | Type | Description |
|---|---|---|
| config | GithubCICDBotConfig | Validated configuration object with all fields resolved |
Usage Examples
Basic Usage
# In SQLMesh config.yaml:
# cicd_bot:
# type: github
# invalidate_environment_after_deploy: true
# enable_deploy_command: true
# merge_method: squash
# skip_pr_backfill: true
# default_pr_start: 2024-01-01
# Loading configuration programmatically:
from sqlmesh.integrations.github.cicd.config import GithubCICDBotConfig, MergeMethod
# Minimal configuration
config = GithubCICDBotConfig()
# Configuration with deployment commands enabled
config = GithubCICDBotConfig(
enable_deploy_command=True,
merge_method=MergeMethod.SQUASH,
command_namespace="/sqlmesh"
)
# Configuration with custom PR environment settings
config = GithubCICDBotConfig(
pr_environment_name="preview",
skip_pr_backfill=True,
default_pr_start="2024-01-01",
pr_min_intervals=7
)
# Access derived properties
prod_branches = config.prod_branch_names # ["main", "master"]
should_skip_backfill = config.skip_pr_backfill # True
forward_suffix = config.forward_only_branch_suffix # "-forward-only"