Last active
January 7, 2020 18:55
-
-
Save refactorsaurusrex/fe9ea70187e519e8a4c408e24a69891b to your computer and use it in GitHub Desktop.
Jenkinsfile: How to get the author name for the HEAD commit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AUTHOR_NAME = bat ( | |
script: "git show -s --format='%%an' HEAD", | |
returnStdout: true | |
).split('\r\n')[2].trim() | |
echo "The last commit was written by ${AUTHOR_NAME}." | |
echo "PS - Jenkins sucks giant monkey balls." |
Patch: Use a single % instead of two.
You need the double % in the Jenkinsfile which is a groovy script.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Patch: Use a single
%
instead of two.