all repos — shwarp.ca @ 8ebd3aa59ecfde64201bd477762d7555818aee57

Homepage repo

scripts/update-changelog (view raw, download)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
#!/bin/sh

# Append breaks so we can source file directly as HTML
# as well as other froofiness for styling

date_pat='([0-9-]+)'
scope_pat='((chore|content|doc|feat|fix|refactor|revert|style|init)(\(.*\))?:?)'
message_pat='(.*)'

date_span='<span class="commit-date">\1<\/span>'
scope_span='<span class="commit-scope">\2<\/span>'
message_span='<span class="commit-message">\5<\/span>'

pattern="$date_pat\s$scope_pat\s?$message_pat?"
replacement="$date_span $scope_span $message_span"

git log --format='%ad %s' --date=short \
    | sed -En "s/$pattern/$replacement<br \/>/p" \
    > static/text/changelog.txt

echo changelog.txt updated

exit 0