From 331077ec0f41b2e39bf0ac1030a0b93e44ab93db Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Tue, 27 Jul 2021 12:11:40 +0200 Subject: [PATCH] fix: default issue labels to [] if null --- lib/platform/github/__snapshots__/index.spec.ts.snap | 8 ++++---- lib/platform/github/index.ts | 2 +- lib/platform/gitlab/__snapshots__/index.spec.ts.snap | 4 ++-- lib/platform/gitlab/index.ts | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/platform/github/__snapshots__/index.spec.ts.snap b/lib/platform/github/__snapshots__/index.spec.ts.snap index 71f24b657b..eaec3c89ba 100644 --- a/lib/platform/github/__snapshots__/index.spec.ts.snap +++ b/lib/platform/github/__snapshots__/index.spec.ts.snap @@ -1590,12 +1590,12 @@ Array [ "url": "https://api.github.com/graphql", }, Object { - "body": "{\\"title\\":\\"new-title\\",\\"body\\":\\"new-content\\"}", + "body": "{\\"title\\":\\"new-title\\",\\"body\\":\\"new-content\\",\\"labels\\":[]}", "headers": Object { "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token abc123", - "content-length": "42", + "content-length": "54", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -1840,12 +1840,12 @@ Array [ "url": "https://api.github.com/repos/some/repo/issues/2", }, Object { - "body": "{\\"title\\":\\"title-2\\",\\"body\\":\\"new-content\\"}", + "body": "{\\"title\\":\\"title-2\\",\\"body\\":\\"new-content\\",\\"labels\\":[]}", "headers": Object { "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token abc123", - "content-length": "40", + "content-length": "52", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts index 7d78bf5dd1..2f16a60a44 100644 --- a/lib/platform/github/index.ts +++ b/lib/platform/github/index.ts @@ -1136,7 +1136,7 @@ export async function ensureIssue({ body: { title, body, - labels, + labels: labels || [], }, } ); diff --git a/lib/platform/gitlab/__snapshots__/index.spec.ts.snap b/lib/platform/gitlab/__snapshots__/index.spec.ts.snap index d1499c65be..91bbdf4f78 100644 --- a/lib/platform/gitlab/__snapshots__/index.spec.ts.snap +++ b/lib/platform/gitlab/__snapshots__/index.spec.ts.snap @@ -684,12 +684,12 @@ Array [ "url": "https://gitlab.com/api/v4/projects/undefined/issues?per_page=100&author_id=undefined&state=opened", }, Object { - "body": "{\\"title\\":\\"new-title\\",\\"description\\":\\"new-content\\"}", + "body": "{\\"title\\":\\"new-title\\",\\"description\\":\\"new-content\\",\\"labels\\":[]}", "headers": Object { "accept": "application/json", "accept-encoding": "gzip, deflate, br", "authorization": "Bearer abc123", - "content-length": "49", + "content-length": "61", "content-type": "application/json", "host": "gitlab.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", diff --git a/lib/platform/gitlab/index.ts b/lib/platform/gitlab/index.ts index 18125a3e26..7c43c8fe1d 100644 --- a/lib/platform/gitlab/index.ts +++ b/lib/platform/gitlab/index.ts @@ -824,7 +824,7 @@ export async function ensureIssue({ body: { title, description, - labels, + labels: labels || [], }, }); logger.info('Issue created'); -- GitLab