mirror of
https://code.forgejo.org/actions/checkout.git
synced 2025-04-21 09:10:16 +03:00
fix tests and update index.js
This commit is contained in:
parent
5fba9eb899
commit
ab5d862ce8
11 changed files with 67 additions and 38 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue