Skip to content

Commit 57c6e77

Browse files
authored
fix(forgejo,gitea): full name can be empty (renovatebot#41950)
1 parent f46fa61 commit 57c6e77

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

lib/modules/platform/forgejo/index.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,13 @@ describe('modules/platform/forgejo/index', () => {
292292
const scope = httpMock.scope('https://code.forgejo.org/api/v1');
293293
scope
294294
.get('/user')
295-
.reply(200, mockUser)
295+
.reply(200, { ...mockUser, full_name: '' })
296296
.get('/version')
297297
.reply(200, { version: FORGEJO_VERSION });
298298

299299
expect(await forgejo.initPlatform({ token: 'some-token' })).toEqual({
300300
endpoint: 'https://code.forgejo.org/',
301-
gitAuthor: 'Renovate Bot <renovate@example.com>',
301+
gitAuthor: 'renovate <renovate@example.com>',
302302
});
303303
});
304304

lib/modules/platform/forgejo/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ const platform: Platform = {
227227
let gitAuthor: string;
228228
try {
229229
const user = await helper.getCurrentUser({ token });
230-
gitAuthor = `${user.full_name ?? user.username} <${user.email}>`;
230+
// oxlint-disable-next-line typescript/prefer-nullish-coalescing -- `full_name` can be emtpy string
231+
gitAuthor = `${user.full_name || user.username} <${user.email}>`;
231232
botUserID = user.id;
232233
botUserName = user.username;
233234
const env = getEnv();

lib/modules/platform/gitea/index.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,13 @@ describe('modules/platform/gitea/index', () => {
284284
const scope = httpMock.scope('https://gitea.com/api/v1');
285285
scope
286286
.get('/user')
287-
.reply(200, mockUser)
287+
.reply(200, { ...mockUser, full_name: '' })
288288
.get('/version')
289289
.reply(200, { version: GITEA_VERSION });
290290

291291
expect(await gitea.initPlatform({ token: 'some-token' })).toEqual({
292292
endpoint: 'https://gitea.com/',
293-
gitAuthor: 'Renovate Bot <renovate@example.com>',
293+
gitAuthor: 'renovate <renovate@example.com>',
294294
});
295295
});
296296

lib/modules/platform/gitea/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ const platform: Platform = {
223223
let gitAuthor: string;
224224
try {
225225
const user = await helper.getCurrentUser({ token });
226-
gitAuthor = `${user.full_name ?? user.username} <${user.email}>`;
226+
// oxlint-disable-next-line typescript/prefer-nullish-coalescing -- `full_name` can be emtpy string
227+
gitAuthor = `${user.full_name || user.username} <${user.email}>`;
227228
botUserID = user.id;
228229
botUserName = user.username;
229230
const env = getEnv();

0 commit comments

Comments
 (0)