fix: omit the body from renovate PR notifications (#657)

This commit is contained in:
bo0tzz
2026-09-29 10:28:46 +02:00
committed by GitHub
parent a7d8276bdb
commit d259b74498
2 changed files with 22 additions and 1 deletions
+18
View File
@@ -1394,6 +1394,24 @@ describe(WebhookService.name, () => {
expect(sent()).toEqual({ discord: [], mattermost: [], zulip: [] });
});
it('should post an opened PR from renovate without its body', async () => {
zulipMock.isInitialised.mockReturnValue(true);
await sut.onGithub(
githubEvent('pull_request', {
action: 'opened',
sender: { ...sender, login: 'renovate[bot]', type: 'Bot' },
repository: immichRepo,
pull_request: makePullRequest(),
}),
'github-slug',
);
const posts = sent();
expect(posts.discord).not.toEqual([]);
expect(posts.zulip).not.toEqual([]);
expect(JSON.stringify(posts)).not.toContain('This PR adds a thing.');
});
it('should post an opened non-draft PR (Green) with its body', async () => {
await sut.onGithub(pullRequestEvent('opened', makePullRequest()), 'github-slug');
expect(sent()).toMatchInlineSnapshot(`
+4 -1
View File
@@ -137,7 +137,10 @@ const getEventNotification = ({
author: toAuthor(user),
title: `[${repositoryName}] ${title} ${action}: #${event.number} ${event.title}`,
url: event.html_url,
body: (action === 'opened' || action === 'created') && event.body ? shorten(event.body, 500) : undefined,
body:
(action === 'opened' || action === 'created') && event.body && user.login !== 'renovate[bot]'
? shorten(event.body, 500)
: undefined,
});
const getIncidentAccent = ({ status, impact }: { status: string; impact: string }): NotificationAccent => {