Skip to content

Commit e9e7dbe

Browse files
eliecharrasundowndev
authored andcommitted
Merge pull request #1314 from snyk/fix/changelog-script
Handle patch releases in changelog script
1 parent 42d9259 commit e9e7dbe

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scripts/changelog.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#!/usr/bin/env bash
22

3+
# This script compare merged pull requests between the two most recent tags
34
# Please note that this script only work with Github repositories.
45
# Prerequisites: git, github cli
56

67
GHCLI_BIN="gh"
78
REPO="snyk/driftctl"
8-
LATEST_TAG=$(git describe --abbrev=0) # Get the least created tag
9-
DEFAULT_BRANCH=origin/HEAD
10-
BASE=$DEFAULT_BRANCH # Change this if you don't want to use the default branch as base
9+
LATEST_TAG=$(git for-each-ref --sort=-taggerdate --format '%(tag)' refs/tags | sed -n 1p) # Get the last created tag
10+
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
11+
BASE=$(git for-each-ref --sort=-taggerdate --format '%(tag)' refs/tags | sed -n 2p) # Use $CURRENT_BRANCH instead to get a pre-release changelog
1112

1213
# Check GH cli is installed
1314
if ! which $GHCLI_BIN &> /dev/null; then

0 commit comments

Comments
 (0)