mirror of
https://code.forgejo.org/actions/checkout.git
synced 2024-12-23 04:05:59 +01:00
Set default user.name and user.email
This commit is contained in:
parent
afe4af09a7
commit
d48599a299
1 changed files with 9 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
|
import * as github from '@actions/github'
|
||||||
import * as fsHelper from './fs-helper'
|
import * as fsHelper from './fs-helper'
|
||||||
import * as gitAuthHelper from './git-auth-helper'
|
import * as gitAuthHelper from './git-auth-helper'
|
||||||
import * as gitCommandManager from './git-command-manager'
|
import * as gitCommandManager from './git-command-manager'
|
||||||
|
@ -216,6 +217,14 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
||||||
settings.ref,
|
settings.ref,
|
||||||
settings.commit
|
settings.commit
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Set default author
|
||||||
|
if (!await git.configExists('user.name', true) {
|
||||||
|
await git.config('user.name', github.context.workflow, true)
|
||||||
|
}
|
||||||
|
if (!await git.configExists('user.email', true) {
|
||||||
|
await git.config('user.email', 'github-actions@github.com', true)
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
// Remove auth
|
// Remove auth
|
||||||
if (!settings.persistCredentials) {
|
if (!settings.persistCredentials) {
|
||||||
|
|
Loading…
Reference in a new issue