Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions webhook_server/libs/pull_request_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ async def process_pull_request_webhook_data(self, pull_request: PullRequest) ->

if hook_action == "edited":
await self.set_wip_label_based_on_title(pull_request=pull_request)
if self.hook_data["changes"].get("title"):
self.logger.info(f"{self.log_prefix} PR title changed, running conventional title check")
await self.runner_handler.run_conventional_title_check(pull_request=pull_request)

if hook_action in ("opened", "reopened", "ready_for_review"):
tasks: list[Coroutine[Any, Any, Any]] = []
Expand Down
15 changes: 15 additions & 0 deletions webhook_server/tests/test_pull_request_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,26 @@ async def test_process_pull_request_webhook_data_edited_action(
) -> None:
"""Test processing pull request webhook data when action is edited."""
pull_request_handler.hook_data["action"] = "edited"
pull_request_handler.hook_data["changes"] = {}

with patch.object(pull_request_handler, "set_wip_label_based_on_title") as mock_set_wip:
await pull_request_handler.process_pull_request_webhook_data(mock_pull_request)
mock_set_wip.assert_called_once_with(pull_request=mock_pull_request)

@pytest.mark.asyncio
async def test_process_pull_request_webhook_data_edited_action_title_changed(
self, pull_request_handler: PullRequestHandler, mock_pull_request: Mock
) -> None:
"""Test processing pull request webhook data when action is edited and title is changed."""
pull_request_handler.hook_data["action"] = "edited"
pull_request_handler.hook_data["changes"] = {"title": {"from": "old title"}}

with patch.object(
pull_request_handler.runner_handler, "run_conventional_title_check"
) as mock_run_conventional_title_check:
await pull_request_handler.process_pull_request_webhook_data(mock_pull_request)
mock_run_conventional_title_check.assert_called_once_with(pull_request=mock_pull_request)

@pytest.mark.asyncio
async def test_process_pull_request_webhook_data_opened_action(
self, pull_request_handler: PullRequestHandler, mock_pull_request: Mock
Expand Down