From 83f5102efb0d57b0031b76c7b2789c6f89949103 Mon Sep 17 00:00:00 2001 From: Mike Miller Date: Thu, 27 Jan 2022 07:22:54 +0200 Subject: [PATCH] Handle merge commits / versioning more gracefully (#162) --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 753ae2ddae..d7c9884d0b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,7 +51,7 @@ jobs: id: version run: | MAJOR_MINOR=$(git describe --tags --abbrev=0 --match "v[0-9]*.[0-9]*" ${{ github.event.pull_request.head.sha }}) - PATCH_VERSION=$(git describe --tags --match "v[0-9]*.[0-9]*" ${{ github.event.pull_request.head.sha }} | cut -d'-' -f2) + PATCH_VERSION=$(git describe --tags --match "v[0-9]*.[0-9]*" --first-parent ${{ github.event.pull_request.head.sha }} | cut -d'-' -f2) STAMP=$(git describe --tags --match "v[0-9]*.[0-9]*" ${{ github.event.pull_request.head.sha }} | cut -d'-' -f3) if [ $PATCH_VERSION == $MAJOR_MINOR ] then @@ -80,7 +80,7 @@ jobs: else PREV=$(git describe --tags --match "v[0-9]*.[0-9]*" --abbrev=0 HEAD^) fi - CHANGELOG=$(git log --pretty=oneline $PREV..HEAD) + CHANGELOG=$(git log --pretty=oneline --first-parent $PREV..HEAD) CHANGELOG="${CHANGELOG//'%'/'%25'}" CHANGELOG="${CHANGELOG//$'\n'/'%0A'}" CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"