Skip to content

Conversation

@mostafa630
Copy link
Contributor

@mostafa630 mostafa630 commented Sep 9, 2025

This PR introduces a new functionality by using process_pr_description_commands that allows commands written in the PR description to be processed in the same way as regular pull request comments.

  • added create_pr_description_comment to convert a PR description into a PullRequestComment
  • reuse the existing handle_comment function
  • updated handle_pull_request_opened signature to include ctx: Arc<BorsContext> and merge_queue_tx: MergeQueueSender because handle_comment function needs them.
  • call the process_pr_description_commands inside the handle_pull_request_opened
  • Add process_bors_commands_in_pr_description test

@Kobzol
Copy link
Member

Kobzol commented Sep 9, 2025

Hi, thanks for the PR! I thought that we'd generate the PR comment in the webhook handler itself, so that the rest of the codebase doesn't even know about where the comment is coming from, but this also works.

Could you please add a test for this? You can copy-paste enqueue_prs_on_pr_opened, and in the open_pr closure, set something to the PR's description (e.g. start a try build or set the PR's priority), and then check that bors reacted to it. You can check other tests for examples, look for @bors commands in them.

@mostafa630 mostafa630 force-pushed the handle-pr-description-commands branch from b2502ab to 9667c38 Compare September 9, 2025 09:18
@mostafa630
Copy link
Contributor Author

@Kobzol
I’ve added the test function process_bors_commands_in_pr_description and it works as expected

If I understand correctly, instead of adding the logic in pr_event.rs, we could move it to handler/mod.rs and call it after the handle_pull_request_opened(....) function call:

BorsRepositoryEvent::PullRequestOpened(payload) {
    ..............
    handle_pull_request_opened(......)
    process_pr_description_commands(....)
}

This approach for sure would leave pr_event.rs unchanged just the added test ,so if that what you need I can do it for sure

Copy link
Member

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

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

I was more thinking about generating two events per opened PR in the webhook code, but it would needlessly complicate the code for a single use-case, your solution is fine. And the test looks good, thank you!

@Kobzol Kobzol added this pull request to the merge queue Sep 9, 2025
Merged via the queue into rust-lang:main with commit 0f7e007 Sep 9, 2025
2 checks passed
@mostafa630
Copy link
Contributor Author

@Kobzol
Thank you for reviewing and merging , I appreciate your time and feedback.

@mostafa630 mostafa630 deleted the handle-pr-description-commands branch September 9, 2025 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants