Capture name of who made the Gitlab commit

How to capture the name of the developer who committed there in gitlab, so that my notification shows his name. I’ve already tried using available variables, but without success, they all only bring ScmChange

           if (currentBuild.resultIsBetterOrEqualTo('SUCCESS')) {
                resultMessage = "Build do projeto ${env.JOB_NAME} realizado por ${env.BUILD_USER_ID} foi feito com Sucesso na BRANCH $BRANCH."
            } else {
                resultMessage = "Falha no projeto ${env.JOB_NAME}"

try this if you are on unix

// Get the commit hash and author's name
def commitHash = sh(script: 'git rev-parse HEAD', returnStdout: true).trim()
def commitAuthor = sh(script: 'git log -1 --pretty=format:%an', returnStdout: true).trim()

It worked perfectly, thank you very much for your support