diff options
| author | Claudomator Agent <agent@claudomator> | 2026-03-16 05:08:00 +0000 |
|---|---|---|
| committer | Claudomator Agent <agent@claudomator> | 2026-03-16 05:08:00 +0000 |
| commit | c2aa026f6ce1c9e216b99d74f294fc133d5fcddd (patch) | |
| tree | 2fdbc85367b92e5ba0d5cd9b789f4f4cf34aad61 /internal/config | |
| parent | d75a231d8865d9b14fbe3d608c9aa1bffb7ed386 (diff) | |
feat: add GitHub webhook endpoint for automatic CI failure task creation
Adds POST /api/webhooks/github that receives check_run and workflow_run
events and creates a Claudomator task to investigate and fix the failure.
- Config: new webhook_secret and [[projects]] fields in config.toml
- HMAC-SHA256 validation when webhook_secret is configured
- Ignores non-failure events (success, skipped, etc.) with 204
- Matches repo name to configured project dirs (case-insensitive)
- Falls back to single project when no name match found
- 11 new tests covering all acceptance criteria
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/config')
| -rw-r--r-- | internal/config/config.go | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index 8c5aebf..ce3b53f 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -9,17 +9,25 @@ import ( "github.com/BurntSushi/toml" ) +// Project represents a named workspace project used for webhook routing. +type Project struct { + Name string `toml:"name"` + Dir string `toml:"dir"` +} + type Config struct { - DataDir string `toml:"data_dir"` - DBPath string `toml:"-"` - LogDir string `toml:"-"` - ClaudeBinaryPath string `toml:"claude_binary_path"` - GeminiBinaryPath string `toml:"gemini_binary_path"` - MaxConcurrent int `toml:"max_concurrent"` - DefaultTimeout string `toml:"default_timeout"` - ServerAddr string `toml:"server_addr"` - WebhookURL string `toml:"webhook_url"` - WorkspaceRoot string `toml:"workspace_root"` + DataDir string `toml:"data_dir"` + DBPath string `toml:"-"` + LogDir string `toml:"-"` + ClaudeBinaryPath string `toml:"claude_binary_path"` + GeminiBinaryPath string `toml:"gemini_binary_path"` + MaxConcurrent int `toml:"max_concurrent"` + DefaultTimeout string `toml:"default_timeout"` + ServerAddr string `toml:"server_addr"` + WebhookURL string `toml:"webhook_url"` + WorkspaceRoot string `toml:"workspace_root"` + WebhookSecret string `toml:"webhook_secret"` + Projects []Project `toml:"projects"` } func Default() (*Config, error) { |
