Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the GitHub assign and review bots to use the slash_command event type instead of manually parsing issue_comment events. This simplifies the handler code by delegating command detection and argument parsing to the AutoKitteh event system, resulting in cleaner, more maintainable code.
Key Changes:
- Migrated from
issue_commentevent type toslash_commandevent type in YAML configurations - Replaced manual command parsing with structured
event.data.command.argsaccess - Removed redundant command validation logic in handlers
- Updated filters to use
data.actual_event_type,data.actual_data, anddata.command.name
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| github_review/handlers.py | Refactored to use event.data.command.args and event.data.actual_data instead of manual command parsing |
| github_review/autokitteh.yaml | Changed event type to slash_command and updated filters to use structured command data |
| github_assign/handlers.py | Refactored to use event.data.command.args and event.data.actual_data instead of manual command parsing |
| github_assign/autokitteh.yaml | Changed event type to slash_command and updated filters to use structured command data |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| event_type: slash_command | ||
| call: handlers.py:on_review_issue_comment | ||
| filter: "data.comment.body.startsWith('/review') && (data.action in ['created', 'edited'])" | ||
| filter: "data.actual_event_type == 'issue_comment' && data.actual_data.action == 'created' && data.command.name == 'review'" |
There was a problem hiding this comment.
The filter no longer includes the 'edited' action that was supported in the original implementation. The old filter checked data.action in ['created', 'edited'], but the new filter only checks for data.actual_data.action == 'created'. This means slash commands in edited comments will no longer trigger the handler. If this behavior change is intentional, it should be documented; otherwise, the filter should be updated to: data.actual_event_type == 'issue_comment' && data.actual_data.action in ['created', 'edited'] && data.command.name == 'review'
| filter: "data.actual_event_type == 'issue_comment' && data.actual_data.action == 'created' && data.command.name == 'review'" | |
| filter: "data.actual_event_type == 'issue_comment' && data.actual_data.action in ['created', 'edited'] && data.command.name == 'review'" |
| event_type: slash_command | ||
| call: handlers.py:on_unreview_issue_comment | ||
| filter: "data.comment.body.startsWith('/unreview') && (data.action in ['created', 'edited'])" | ||
| filter: "data.actual_event_type == 'issue_comment' && data.actual_data.action == 'created' && data.command.name == 'unreview'" |
There was a problem hiding this comment.
The filter no longer includes the 'edited' action that was supported in the original implementation. The old filter checked data.action in ['created', 'edited'], but the new filter only checks for data.actual_data.action == 'created'. This means slash commands in edited comments will no longer trigger the handler. If this behavior change is intentional, it should be documented; otherwise, the filter should be updated to: data.actual_event_type == 'issue_comment' && data.actual_data.action in ['created', 'edited'] && data.command.name == 'unreview'
| filter: "data.actual_event_type == 'issue_comment' && data.actual_data.action == 'created' && data.command.name == 'unreview'" | |
| filter: "data.actual_event_type == 'issue_comment' && data.actual_data.action in ['created', 'edited'] && data.command.name == 'unreview'" |
| event_type: slash_command | ||
| call: handlers.py:on_assign_issue_comment | ||
| filter: "data.comment.body.startsWith('/assign') && (data.action in ['created', 'edited'])" | ||
| filter: "data.actual_event_type == 'issue_comment' && data.actual_data.action == 'created' && data.command.name == 'assign'" |
There was a problem hiding this comment.
The filter no longer includes the 'edited' action that was supported in the original implementation. The old filter checked data.action in ['created', 'edited'], but the new filter only checks for data.actual_data.action == 'created'. This means slash commands in edited comments will no longer trigger the handler. If this behavior change is intentional, it should be documented; otherwise, the filter should be updated to: data.actual_event_type == 'issue_comment' && data.actual_data.action in ['created', 'edited'] && data.command.name == 'assign'
| filter: "data.actual_event_type == 'issue_comment' && data.actual_data.action == 'created' && data.command.name == 'assign'" | |
| filter: "data.actual_event_type == 'issue_comment' && data.actual_data.action in ['created', 'edited'] && data.command.name == 'assign'" |
| event_type: slash_command | ||
| call: handlers.py:on_unassign_issue_comment | ||
| filter: "data.comment.body.startsWith('/unassign') && (data.action in ['created', 'edited'])" | ||
| filter: "data.actual_event_type == 'issue_comment' && data.actual_data.action == 'created' && data.command.name == 'unassign'" |
There was a problem hiding this comment.
The filter no longer includes the 'edited' action that was supported in the original implementation. The old filter checked data.action in ['created', 'edited'], but the new filter only checks for data.actual_data.action == 'created'. This means slash commands in edited comments will no longer trigger the handler. If this behavior change is intentional, it should be documented; otherwise, the filter should be updated to: data.actual_event_type == 'issue_comment' && data.actual_data.action in ['created', 'edited'] && data.command.name == 'unassign'
| filter: "data.actual_event_type == 'issue_comment' && data.actual_data.action == 'created' && data.command.name == 'unassign'" | |
| filter: "data.actual_event_type == 'issue_comment' && data.actual_data.action in ['created', 'edited'] && data.command.name == 'unassign'" |
No description provided.