mirror of https://github.com/zulip/zulip.git
integrations: Remove ignore_pull_requests from Travis CI webhook.
Removes the ignore_pull_requests URL parameter from the Travis CI integration because its functionality is now fully covered by the standard incoming webhook event filtering framework. Fixes #30934.
This commit is contained in:
parent
a89deb5e5c
commit
a534e9fdb6
|
@ -27,12 +27,6 @@ See your Travis CI build notifications in Zulip!
|
||||||
|
|
||||||
{!event-filtering-additional-feature.md!}
|
{!event-filtering-additional-feature.md!}
|
||||||
|
|
||||||
### Configuration options
|
|
||||||
|
|
||||||
- By default, pull request events are ignored since most people don't
|
|
||||||
want notifications for new pushes to pull requests. To enable
|
|
||||||
notifications for pull request builds, you can append
|
|
||||||
`&ignore_pull_requests=false` to the end of the generated URL.
|
|
||||||
|
|
||||||
### Related documentation
|
### Related documentation
|
||||||
|
|
||||||
|
|
|
@ -31,13 +31,8 @@ Details: [changes](https://github.com/hl7-fhir/fhir-svn/compare/6dccb98bcfd9...6
|
||||||
content_type="application/x-www-form-urlencoded",
|
content_type="application/x-www-form-urlencoded",
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_ignore_travis_pull_request_by_default(self) -> None:
|
def test_travis_only_pull_request_event(self) -> None:
|
||||||
self.check_webhook(
|
self.url = f'{self.build_webhook_url()}&only_events=["pull_request"]'
|
||||||
"pull_request", content_type="application/x-www-form-urlencoded", expect_noop=True
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_travis_pull_requests_are_not_ignored_when_applicable(self) -> None:
|
|
||||||
self.url = f"{self.build_webhook_url()}&ignore_pull_requests=false"
|
|
||||||
|
|
||||||
self.check_webhook(
|
self.check_webhook(
|
||||||
"pull_request",
|
"pull_request",
|
||||||
|
@ -46,6 +41,28 @@ Details: [changes](https://github.com/hl7-fhir/fhir-svn/compare/6dccb98bcfd9...6
|
||||||
content_type="application/x-www-form-urlencoded",
|
content_type="application/x-www-form-urlencoded",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.check_webhook(
|
||||||
|
"build",
|
||||||
|
content_type="application/x-www-form-urlencoded",
|
||||||
|
expect_noop=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_travis_exclude_pull_request_event(self) -> None:
|
||||||
|
self.url = f'{self.build_webhook_url()}&exclude_events=["pull_request"]'
|
||||||
|
|
||||||
|
self.check_webhook(
|
||||||
|
"pull_request",
|
||||||
|
content_type="application/x-www-form-urlencoded",
|
||||||
|
expect_noop=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
self.check_webhook(
|
||||||
|
"build",
|
||||||
|
self.TOPIC_NAME,
|
||||||
|
self.EXPECTED_MESSAGE,
|
||||||
|
content_type="application/x-www-form-urlencoded",
|
||||||
|
)
|
||||||
|
|
||||||
def test_travis_only_push_event(self) -> None:
|
def test_travis_only_push_event(self) -> None:
|
||||||
self.url = f'{self.build_webhook_url()}&only_events=["push"]'
|
self.url = f'{self.build_webhook_url()}&only_events=["push"]'
|
||||||
|
|
||||||
|
@ -56,9 +73,6 @@ Details: [changes](https://github.com/hl7-fhir/fhir-svn/compare/6dccb98bcfd9...6
|
||||||
content_type="application/x-www-form-urlencoded",
|
content_type="application/x-www-form-urlencoded",
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_travis_only_push_event_not_sent(self) -> None:
|
|
||||||
self.url = f'{self.build_webhook_url()}&only_events=["push"]&ignore_pull_requests=false'
|
|
||||||
|
|
||||||
self.check_webhook(
|
self.check_webhook(
|
||||||
"pull_request",
|
"pull_request",
|
||||||
content_type="application/x-www-form-urlencoded",
|
content_type="application/x-www-form-urlencoded",
|
||||||
|
@ -74,9 +88,6 @@ Details: [changes](https://github.com/hl7-fhir/fhir-svn/compare/6dccb98bcfd9...6
|
||||||
expect_noop=True,
|
expect_noop=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_travis_exclude_push_event_sent(self) -> None:
|
|
||||||
self.url = f'{self.build_webhook_url()}&exclude_events=["push"]&ignore_pull_requests=false'
|
|
||||||
|
|
||||||
self.check_webhook(
|
self.check_webhook(
|
||||||
"pull_request",
|
"pull_request",
|
||||||
self.TOPIC_NAME,
|
self.TOPIC_NAME,
|
||||||
|
@ -85,7 +96,7 @@ Details: [changes](https://github.com/hl7-fhir/fhir-svn/compare/6dccb98bcfd9...6
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_travis_include_glob_events(self) -> None:
|
def test_travis_include_glob_events(self) -> None:
|
||||||
self.url = f'{self.build_webhook_url()}&include_events=["*"]&ignore_pull_requests=false'
|
self.url = f'{self.build_webhook_url()}&include_events=["*"]'
|
||||||
|
|
||||||
self.check_webhook(
|
self.check_webhook(
|
||||||
"pull_request",
|
"pull_request",
|
||||||
|
@ -102,7 +113,7 @@ Details: [changes](https://github.com/hl7-fhir/fhir-svn/compare/6dccb98bcfd9...6
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_travis_exclude_glob_events(self) -> None:
|
def test_travis_exclude_glob_events(self) -> None:
|
||||||
self.url = f'{self.build_webhook_url()}&exclude_events=["*"]&ignore_pull_requests=false'
|
self.url = f'{self.build_webhook_url()}&exclude_events=["*"]'
|
||||||
|
|
||||||
self.check_webhook(
|
self.check_webhook(
|
||||||
"pull_request",
|
"pull_request",
|
||||||
|
|
|
@ -40,12 +40,9 @@ def api_travis_webhook(
|
||||||
user_profile: UserProfile,
|
user_profile: UserProfile,
|
||||||
*,
|
*,
|
||||||
message: Annotated[Json[TravisPayload], ApiParamConfig("payload")],
|
message: Annotated[Json[TravisPayload], ApiParamConfig("payload")],
|
||||||
ignore_pull_requests: Json[bool] = True,
|
|
||||||
) -> HttpResponse:
|
) -> HttpResponse:
|
||||||
event = message.type
|
event = message.type
|
||||||
message_status = message.status_message
|
message_status = message.status_message
|
||||||
if ignore_pull_requests and message.type == "pull_request":
|
|
||||||
return json_success(request)
|
|
||||||
|
|
||||||
if message_status in GOOD_STATUSES:
|
if message_status in GOOD_STATUSES:
|
||||||
emoji = ":thumbs_up:"
|
emoji = ":thumbs_up:"
|
||||||
|
|
Loading…
Reference in New Issue