bash script to generate changelog focused for Drupal modules
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 | |
# Author: Luigi Guevara <@killua99> | |
# | |
# Use | |
# For a Simple Tag changelog | |
# ./changelog > CHANGELOG.txt | |
# | |
# For a current dev branch with the old tag log | |
# ./changelog 7.x-2.x > CHANGELOG.txt | |
MODULE_NAME=`grep -oP 'name\s*=\s*.*' *.info | grep -oP '[^name\s*=\s*].*'` | |
CURRENT_BRANCH=$1 | |
echo "CHANGELOG: $MODULE_NAME" | |
echo ----------------------------- | |
if [ $CURRENT_BRANCH ]; then | |
echo | |
echo "[$CURRENT_BRANCH xxxx-xx-xx] (Dev branch)" | |
echo | |
LOG=$(git log --no-merges --format=' - %w(75,0,3)%s' $CURRENT_BRANCH) | |
echo "$LOG" | |
fi | |
git for-each-ref --shell --sort='-authordate' --format="tag=%(refname:short) date=%(authordate:short)" refs/tags | \ | |
while read ENTRY | |
do | |
eval $ENTRY | |
LOG=$(git log --no-merges --format=" - %w(75,0,3)%s" $tag) | |
echo | |
echo "[$tag - $date]" | |
echo | |
echo "$LOG" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment