fix tests and update index.js

This commit is contained in:
Nicolas Schweitzer 2025-01-22 11:55:00 +01:00
parent 5fba9eb899
commit ab5d862ce8
No known key found for this signature in database
11 changed files with 67 additions and 38 deletions

View file

@ -275,14 +275,21 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
settings.githubServerUrl
)
if (settings.gitUser) {
if (!await git.configExists('user.name', true)) {
if (!(await git.configExists('user.name', true))) {
await git.config('user.name', settings.gitUser, true)
}
if (!await git.configExists('user.email', true)) {
const userId = await githubApiHelper.getUserId(settings.gitUser, settings.authToken, settings.githubServerUrl);
await git.config('user.email', `${userId}+${settings.gitUser}@users.noreply.github.com`, true)
}
if (!(await git.configExists('user.email', true))) {
const userId = await githubApiHelper.getUserId(
settings.gitUser,
settings.authToken,
settings.githubServerUrl
)
await git.config(
'user.email',
`${userId}+${settings.gitUser}@users.noreply.github.com`,
true
)
}
}
} finally {
// Remove auth

View file

@ -152,6 +152,6 @@ export async function getUserId(
const octokit = github.getOctokit(authToken, {
baseUrl: getServerApiUrl(baseUrl)
})
const user = await octokit.rest.users.getByUsername({username,});
const user = await octokit.rest.users.getByUsername({username})
return user.data.id
}