diff --git a/.github/scripts/changelog.sh b/.github/scripts/changelog.sh index f8e80d6f..196bc038 100755 --- a/.github/scripts/changelog.sh +++ b/.github/scripts/changelog.sh @@ -1,5 +1,7 @@ #!/bin/bash +release_has_public_changes=false + url=$(git remote get-url origin | sed -r 's/(.*)\.git/\1/') previous_tag=$(git describe --tags --abbrev=0 HEAD~) @@ -23,5 +25,12 @@ do # Escape markdown formatting symbols _ * ` echo " $line" | sed 's/_/\\_/g' | sed 's/`/\\`/g' | sed 's/\*/\\\*/g' done + release_has_public_changes=true fi done + +if ! $release_has_public_changes +then + echo "No public changes since $previous_tag." >&2 + exit 1 +fi diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 33527a9c..a88dfc35 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -20,10 +20,13 @@ jobs: run: tar -czf forgit-${{github.ref_name}}.tar.gz --exclude LICENSE --exclude README.md * - name: Generate Changelog + id: changelog run: .github/scripts/changelog.sh > CHANGELOG.md + continue-on-error: true - name: Release uses: softprops/action-gh-release@v2 + if: steps.changelog.outcome == 'success' with: body_path: CHANGELOG.md files: forgit-${{github.ref_name}}.tar.gz