Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GitLab] Change email source in gitAuthor #12532

Closed
Tracked by #21134
AKorezin opened this issue Nov 6, 2021 · 2 comments · Fixed by #21122
Closed
Tracked by #21134

[GitLab] Change email source in gitAuthor #12532

AKorezin opened this issue Nov 6, 2021 · 2 comments · Fixed by #21122
Assignees
Labels
breaking Breaking change, requires major version bump platform:gitlab GitLab Platform priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others status:in-progress Someone is working on implementation type:feature Feature (new functionality) v36

Comments

@AKorezin
Copy link

AKorezin commented Nov 6, 2021

What would you like Renovate to be able to do?

There's a special email for commits in gitlab user profile.
The name of the parameter is commit_email.
It has been added in gitlab 13.11.
I think that commit_email should be used instead of email parameter for gitAuthor.

curl --header 'PRIVATE-TOKEN: <token>' https://gitlab.com/api/v4/user | 
  jq '{email: .email, commit_email: .commit_email, public_email: .public_email}'

I don't know why it's not documented in /user api.

If you have any ideas on how this should be implemented, please tell us here.

const user = (
await gitlabApi.getJson<{ email: string; name: string; id: number }>(
`user`,
{ token }
)
).body;
platformConfig.gitAuthor = `${user.name} <${user.email}>`;

--- a/lib/platform/gitlab/index.ts
+++ b/lib/platform/gitlab/index.ts
@@ -99,12 +99,12 @@
   try {
     if (!gitAuthor) {
       const user = (
-        await gitlabApi.getJson<{ email: string; name: string; id: number }>(
-          `user`,
+        await gitlabApi.getJson<{ commit_email: string; name: string; id: number }>(
+          'user',
           { token }
         )
       ).body;
-      platformConfig.gitAuthor = `${user.name} <${user.email}>`;
+      platformConfig.gitAuthor = `${user.name} <${user.commit_email}>`;
     }
     // istanbul ignore if: experimental feature
     if (process.env.RENOVATE_X_PLATFORM_VERSION) {

Is this a feature you are interested in implementing yourself?

No

@AKorezin AKorezin added priority-5-triage status:requirements Full requirements are not yet known, so implementation should not be started type:feature Feature (new functionality) labels Nov 6, 2021
@rarkins
Copy link
Collaborator

rarkins commented Nov 6, 2021

I think we need to have fallback logic too, for anyone not on 13.11 or later

@rarkins rarkins added platform:gitlab GitLab Platform priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others status:ready and removed status:requirements Full requirements are not yet known, so implementation should not be started priority-5-triage labels Nov 6, 2021
@nabeelsaabna nabeelsaabna added the breaking Breaking change, requires major version bump label Apr 11, 2022
@rarkins rarkins added the help wanted Help is needed or welcomed on this issue label Jan 12, 2023
@viceice viceice added status:in-progress Someone is working on implementation and removed help wanted Help is needed or welcomed on this issue status:ready labels Mar 24, 2023
@viceice viceice self-assigned this Mar 24, 2023
@viceice viceice mentioned this issue Mar 24, 2023
28 tasks
@rarkins rarkins added the v36 label Jun 12, 2023
rarkins pushed a commit that referenced this issue Jul 4, 2023
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.
@rarkins rarkins closed this as completed in 08bbf81 Jul 4, 2023
@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 36.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking Breaking change, requires major version bump platform:gitlab GitLab Platform priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others status:in-progress Someone is working on implementation type:feature Feature (new functionality) v36
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants