mirror of
https://github.com/immich-app/discord-bot.git
synced 2026-09-30 13:32:52 +08:00
fix: omit the body from renovate PR notifications (#657)
This commit is contained in:
@@ -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(`
|
||||
|
||||
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user