diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index b2820ec..2ace0c8 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -48,9 +48,14 @@ jobs: if: env.TAG_EXISTS == 'false' id: fetch_commits run: | - git fetch --tags - LAST_TAG=$(git describe --tags --abbrev=0 $(git rev-list --tags --max-count=1)) - COMMIT_MESSAGES=$(git log $LAST_TAG..HEAD --pretty=format:"- %s") + git fetch --tags --unshallow || true + LAST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1) 2>/dev/null || echo "") + if [ -z "$LAST_TAG" ]; then + echo "No previous tags found, using the entire history." + COMMIT_MESSAGES=$(git log --pretty=format:"- %s") + else + COMMIT_MESSAGES=$(git log $LAST_TAG..HEAD --pretty=format:"- %s") + fi echo "COMMIT_MESSAGES<> $GITHUB_ENV echo "Full Changelog:" >> $GITHUB_ENV echo "" >> $GITHUB_ENV @@ -87,4 +92,4 @@ jobs: asset_name: HorseGuard-${{ env.VERSION }}.jar asset_content_type: application/java-archive env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}