diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ce2fed8..af36ea3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -52,9 +52,22 @@ jobs: - name: Generate changelog from commits id: generate_changelog run: | - CHANGELOG=$(git log -1 --pretty=%B | tr -d '\n' | sed 's/"/\\"/g') + COMMIT_SUMMARY=$(git log -1 --pretty=%s) + COMMIT_DESCRIPTION=$(git log -1 --pretty=%b | sed ':a;N;$!ba;s/\n/\\n/g') + + if [[ -z "$COMMIT_DESCRIPTION" ]]; then + CHANGELOG="$COMMIT_SUMMARY" + else + CHANGELOG="$COMMIT_SUMMARY\\n\\n$COMMIT_DESCRIPTION" + fi + + if [[ -z "$CHANGELOG" ]]; then + CHANGELOG="Release version ${{ env.VERSION }}" + fi + echo "CHANGELOG=${CHANGELOG}" >> $GITHUB_ENV + - name: Update release with changelog run: | gh release edit ${{ env.VERSION }} --notes "${{ env.CHANGELOG }}"