From 08bbf812b0e7ccf37d50f8ba6b6c509144111a3a Mon Sep 17 00:00:00 2001
From: Michael Kriese <michael.kriese@visualon.de>
Date: Wed, 26 Apr 2023 08:26:13 +0200
Subject: [PATCH] feat(platform/gitlab)!: prefer `commit_email` (#21122)

gitAuthor discover for GitLab now prefers the field `commit_email` over `email`.

Closes #12532

BREAKING CHANGE: GitLab gitAuthor will change from the account's "email" to "commit_email" if they are different.
---
 lib/modules/platform/gitlab/index.ts | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/lib/modules/platform/gitlab/index.ts b/lib/modules/platform/gitlab/index.ts
index 6994940dfc..48d8d0008f 100644
--- a/lib/modules/platform/gitlab/index.ts
+++ b/lib/modules/platform/gitlab/index.ts
@@ -108,12 +108,16 @@ export async function initPlatform({
   try {
     if (!gitAuthor) {
       const user = (
-        await gitlabApi.getJson<{ email: string; name: string; id: number }>(
-          `user`,
-          { token }
-        )
+        await gitlabApi.getJson<{
+          email: string;
+          name: string;
+          id: number;
+          commit_email?: string;
+        }>(`user`, { token })
       ).body;
-      platformConfig.gitAuthor = `${user.name} <${user.email}>`;
+      platformConfig.gitAuthor = `${user.name} <${
+        user.commit_email ?? user.email
+      }>`;
     }
     // istanbul ignore if: experimental feature
     if (process.env.RENOVATE_X_PLATFORM_VERSION) {
-- 
GitLab