Skip to content

Commit e751598

Browse files
committed
refactor: use git -c for commit author instead of global git config
Apply 2bndy5's review suggestion: use single git -c user.name=X -c user.email=Y commit instead of separate git config + git commit. This avoids polluting the global git configuration in the CI environment.
1 parent c9e0ea4 commit e751598

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,15 +526,15 @@ runs:
526526
if $has_changes {
527527
let actor_name = $env.GITHUB_ACTOR
528528
let actor_id = $env.GITHUB_ACTOR_ID
529-
^git config user.name $"($actor_name)"
530-
^git config user.email $"($actor_id)+($actor_name)@users.noreply.github.com"
529+
let git_user = $"user.name=($actor_name)"
530+
let git_email = $"user.email=($actor_id)+($actor_name)@users.noreply.github.com"
531531
^git add -A
532532
let commit_msg = if ('${{ inputs.auto-fix-commit-msg }}' | is-empty) {
533533
'style: apply styling format fix'
534534
} else {
535535
'${{ inputs.auto-fix-commit-msg }}'
536536
}
537-
^git commit -m $"($commit_msg)"
537+
^git -c $git_user -c $git_email commit -m $"($commit_msg)"
538538
let branch = $env.GITHUB_HEAD_REF | default $env.GITHUB_REF_NAME
539539
let push_result = (^git push origin $"HEAD:refs/heads/($branch)") | complete
540540
if $push_result.exit_code != 0 {

0 commit comments

Comments
 (0)