From 2d5f8f48f510146c59fe5531f2eb61d2f1344367 Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 4 Nov 2024 10:17:59 +0100 Subject: [PATCH] Meta: do not create release when there are no public changes (#401) --- .github/scripts/changelog.sh | 9 +++++++++ .github/workflows/release.yaml | 3 +++ 2 files changed, 12 insertions(+) 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