integration: Remove branch names to Gogs edited PR event.

This is a follow up to #24673, we want to modify every webhook events to
follow the same pattern and consistency where branch name should only
show on opened and merged events.
This commit is contained in:
Joelute
2023-04-02 14:07:12 -04:00
committed by Tim Abbott
parent 84b4f498d5
commit 78a9d716ec
2 changed files with 6 additions and 3 deletions

View File

@@ -85,7 +85,7 @@ class GogsHookTests(WebhookTestCase):
def test_pull_request_edited(self) -> None:
expected_topic = "test / PR #1349 Test"
expected_message = """kostekIV edited [PR #2](https://try.gogs.io/kostekIV/test/pulls/2) from `c` to `master`."""
expected_message = """kostekIV edited [PR #2](https://try.gogs.io/kostekIV/test/pulls/2)."""
self.check_webhook("pull_request__edited", expected_topic, expected_message)
def test_pull_request_assigned(self) -> None:

View File

@@ -81,8 +81,11 @@ def format_pull_request_event(payload: WildValue, include_title: bool = False) -
action = payload["action"].tame(check_string)
url = payload["pull_request"]["html_url"].tame(check_string)
number = payload["pull_request"]["number"].tame(check_int)
target_branch = payload["pull_request"]["head_branch"].tame(check_string)
base_branch = payload["pull_request"]["base_branch"].tame(check_string)
target_branch = None
base_branch = None
if action != "edited":
target_branch = payload["pull_request"]["head_branch"].tame(check_string)
base_branch = payload["pull_request"]["base_branch"].tame(check_string)
title = payload["pull_request"]["title"].tame(check_string) if include_title else None
return get_pull_request_event_message(