only send risk notif when risks are found

This commit is contained in:
Maidul Islam
2023-07-19 00:05:19 -04:00
parent 1f3f0375b9
commit da9cb70184
@@ -129,6 +129,7 @@ export default async (app: Probot) => {
const adminOrOwnerEmails = userEmails.map(userObject => userObject.email) const adminOrOwnerEmails = userEmails.map(userObject => userObject.email)
const usersToNotify = pusher?.email ? [pusher.email, ...adminOrOwnerEmails] : [...adminOrOwnerEmails] const usersToNotify = pusher?.email ? [pusher.email, ...adminOrOwnerEmails] : [...adminOrOwnerEmails]
if (Object.keys(allFindingsByFingerprint).length) {
await sendMail({ await sendMail({
template: "secretLeakIncident.handlebars", template: "secretLeakIncident.handlebars",
subjectLine: `Incident alert: leaked secrets found in Github repository ${repository.full_name}`, subjectLine: `Incident alert: leaked secrets found in Github repository ${repository.full_name}`,
@@ -139,6 +140,7 @@ export default async (app: Probot) => {
pusher_name: pusher.name pusher_name: pusher.name
} }
}); });
}
const postHogClient = await TelemetryService.getPostHogClient(); const postHogClient = await TelemetryService.getPostHogClient();
if (postHogClient) { if (postHogClient) {