Last active
October 22, 2016 18:40
-
-
Save mseijas/7b4bfccc286e121d0ae8c3500d6b0c50 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# fail if any commands fails | |
set +e | |
# debug log | |
# set -x | |
lastTag="$(git describe --tags --abbrev=0)" | |
set -e | |
if [ -z "${lastTag}" ]; then | |
changelog="$(git log --pretty="• %s %gn" --abbrev-commit --no-merges --reverse)" | |
else | |
changelog="$(git log "${lastTag}"..HEAD --pretty="• %s %gn" --abbrev-commit --no-merges --reverse)" | |
fi | |
if [ -z "${changelog}" ]; then | |
echo " [!] Unable to retrieve Git Changelog" | |
exit 1 | |
else | |
envman add --key GIT_CHANGELOG --value "${changelog}" | |
echo "Changelog: ${changelog}" | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment