Private/Get-GitAuthorSlug.ps1

<#
.SYNOPSIS
    Resolves the current user's short name for use in branch name slugs.
.DESCRIPTION
    Resolution order:
        1. $env:GIT_USER_SHORTNAME (explicit override, highest priority)
        2. git config user.name (repo-local or global git identity)
        3. $env:USERNAME (OS login name)
        4. 'donkey' (last resort)
 
    The resolved name is slugified via ConvertTo-SafeBranchName.
#>

function Get-GitAuthorSlug {
    [CmdletBinding()]
    [OutputType([string])]
    param(
        [string] $RepoPath = (Get-Location).Path
    )

    $raw = if ($env:GIT_USER_SHORTNAME) {
        $env:GIT_USER_SHORTNAME
    }
    else {
        $gitName = git -C $RepoPath config user.name 2>$null
        if ($gitName) { $gitName } elseif ($env:USERNAME) { $env:USERNAME } else { 'donkey' }
    }

    return ConvertTo-SafeBranchName -Name $raw
}