From 86ed61c6944991e93d2d4cafbe53a9471f8f1dee Mon Sep 17 00:00:00 2001 From: Chevdor Date: Fri, 15 Oct 2021 17:42:21 +0200 Subject: [PATCH] Add script to generate simple changelogs (#668) --- scripts/changelog/.gitignore | 1 + scripts/changelog/README.md | 13 +++++++++++++ scripts/changelog/changelog.sh | 11 +++++++++++ 3 files changed, 25 insertions(+) create mode 100644 scripts/changelog/.gitignore create mode 100644 scripts/changelog/README.md create mode 100755 scripts/changelog/changelog.sh diff --git a/scripts/changelog/.gitignore b/scripts/changelog/.gitignore new file mode 100644 index 0000000000..1a13c36382 --- /dev/null +++ b/scripts/changelog/.gitignore @@ -0,0 +1 @@ +changelog.md diff --git a/scripts/changelog/README.md b/scripts/changelog/README.md new file mode 100644 index 0000000000..318e3a32e2 --- /dev/null +++ b/scripts/changelog/README.md @@ -0,0 +1,13 @@ +# Changelog + +Currently, the changelog is built locally. +Run: + +``` +./changelog.sh +``` + +For instance: +``` +./changelog.sh statemine_v4 +``` diff --git a/scripts/changelog/changelog.sh b/scripts/changelog/changelog.sh new file mode 100755 index 0000000000..cf04e21c1f --- /dev/null +++ b/scripts/changelog/changelog.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +REF1=$1 + +JSON=$(git log $REF1..HEAD \ + --pretty=format:'{ "commit": "%H", "short_sha": "%h", "author": "%an", "date": "%ad", "message": "%s"},' \ + $@ | \ + perl -pe 'BEGIN{print "{ \"since\": \"'${REF1}'\", \"commits\": ["}; END{print "]}"}' | \ + perl -pe 's/},]/}]/') + +echo $JSON | tera --template templates/changelog.md --stdin | tee