fix: parse repository and action from GitHub webhook event#26
Conversation
Add proper extraction of org/repo from the repository object in GitHub webhook events, and parse the event action field. This ensures: - Repository configuration matching works correctly - Transfer loop prevention can detect transferred events - Bot pipeline doesn't skip valid issues due to missing repo info Fixes issue where bot would skip all issues with 'repository not configured' error when repository list was populated.
📝 WalkthroughWalkthroughThe pull request enhances GitHub webhook payload processing by extracting repository ownership information (Org and Repo) and event action data from the raw GitHub payload, enabling richer event metadata population while maintaining existing fallback mechanisms for event type resolution. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
Fixes webhook event parsing in the process command so repository configuration matching and transfer-loop prevention can work when processing raw GitHub webhook payloads.
Changes:
- Extract
repository.owner.loginintoissue.Org - Extract
repository.nameintoissue.Repo - Extract top-level
actionintoissue.EventAction
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Handle repository | ||
| if repo, ok := raw["repository"].(map[string]interface{}); ok { | ||
| if owner, ok := repo["owner"].(map[string]interface{}); ok { | ||
| if login, ok := owner["login"].(string); ok { | ||
| issue.Org = login | ||
| } | ||
| } | ||
| if name, ok := repo["name"].(string); ok { | ||
| issue.Repo = name | ||
| } | ||
| } | ||
|
|
||
| // Fallback event name from GitHub environment if possible | ||
| if issue.EventType == "" { | ||
| issue.EventType = os.Getenv("GITHUB_EVENT_NAME") | ||
| } | ||
|
|
||
| // Handle event action if provided | ||
| if action, ok := raw["action"].(string); ok { | ||
| issue.EventAction = action | ||
| } |
There was a problem hiding this comment.
PR description mentions additional fixes (cross-repo similarity search defaulting to true, markdown table formatting changes) but the diff here only adds parsing for repository.* and action from the webhook payload. Please either update the PR description to match the actual change set, or include the missing commits/files so reviewers can validate those claims.
Summary
Fixed critical bug where the bot was skipping all issues with "repository not configured" error when repository lists were populated.
Problem
The
process.gocommand was not parsing the GitHub webhookrepositoryobject to extract org/repo values needed for configuration matching. This caused all webhook-triggered issues to be rejected at the gatekeeper stage.Solution
Added proper extraction from GitHub webhook payload:
repository.owner.login→issue.Orgrepository.name→issue.Repoactionfield →issue.EventAction(required for transfer loop prevention)This enables:
Related Fixes
This PR builds on previously merged fixes:
This PR: Repository parsing bug that was blocking those features from working
Testing
✅
go build ./...- PASS✅
go test ./...- PASS (all tests)✅ Integration tests verified:
Before/After
Before: All webhook events skipped with "repository not configured"
After: Repository configuration matching works, pipeline processes normally
🤖 Generated with Claude Code