From e9e7dbe9e9396c586e8fa04711c0322586c935c6 Mon Sep 17 00:00:00 2001 From: Elie Date: Tue, 11 Jan 2022 10:37:40 +0100 Subject: [PATCH] Merge pull request #1314 from snyk/fix/changelog-script Handle patch releases in changelog script --- scripts/changelog.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/changelog.sh b/scripts/changelog.sh index 09466ee01..d914c5c5e 100755 --- a/scripts/changelog.sh +++ b/scripts/changelog.sh @@ -1,13 +1,14 @@ #!/usr/bin/env bash +# This script compare merged pull requests between the two most recent tags # Please note that this script only work with Github repositories. # Prerequisites: git, github cli GHCLI_BIN="gh" REPO="snyk/driftctl" -LATEST_TAG=$(git describe --abbrev=0) # Get the least created tag -DEFAULT_BRANCH=origin/HEAD -BASE=$DEFAULT_BRANCH # Change this if you don't want to use the default branch as base +LATEST_TAG=$(git for-each-ref --sort=-taggerdate --format '%(tag)' refs/tags | sed -n 1p) # Get the last created tag +CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) +BASE=$(git for-each-ref --sort=-taggerdate --format '%(tag)' refs/tags | sed -n 2p) # Use $CURRENT_BRANCH instead to get a pre-release changelog # Check GH cli is installed if ! which $GHCLI_BIN &> /dev/null; then