From 96d9aee0a9e325ed18aa75166e88675d722a4e44 Mon Sep 17 00:00:00 2001 From: Mike Bryant Date: Tue, 23 May 2023 11:10:16 +0100 Subject: [PATCH] docs: Fix example to not produce validation errors The previous approach generated the following error when a user has no emails ``` Processor BuiltinKindsEntityProcessor threw an error while validating the entity user:default/user; caused by TypeError: /spec/profile/email must NOT have fewer than 1 characters - limit: 1 ``` Signed-off-by: Mike Bryant --- docs/integrations/github/org.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/integrations/github/org.md b/docs/integrations/github/org.md index ccffe60bd1..bf3eab4f14 100644 --- a/docs/integrations/github/org.md +++ b/docs/integrations/github/org.md @@ -189,8 +189,8 @@ returned identity. async (user, ctx): Promise => { const entity = await defaultUserTransformer(user, ctx); - if (entity && user.organizationVerifiedDomainEmails) { - entity.spec.profile!.email = user.organizationVerifiedDomainEmails[0] || ''; + if (entity && user.organizationVerifiedDomainEmails?.length) { + entity.spec.profile!.email = user.organizationVerifiedDomainEmails[0]; } return entity;