Skip to content

modify github assign/review to use slash_command events#301

Open
itayd wants to merge 1 commit intomainfrom
itay/gh
Open

modify github assign/review to use slash_command events#301
itayd wants to merge 1 commit intomainfrom
itay/gh

Conversation

@itayd
Copy link
Member

@itayd itayd commented Dec 9, 2025

No description provided.

Copilot AI review requested due to automatic review settings December 9, 2025 00:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_comment event type to slash_command event type in YAML configurations
  • Replaced manual command parsing with structured event.data.command.args access
  • Removed redundant command validation logic in handlers
  • Updated filters to use data.actual_event_type, data.actual_data, and data.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'"
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'

Suggested change
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'"

Copilot uses AI. Check for mistakes.
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'"
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'

Suggested change
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'"

Copilot uses AI. Check for mistakes.
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'"
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'

Suggested change
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'"

Copilot uses AI. Check for mistakes.
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'"
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'

Suggested change
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'"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants