Skip to content

Commit

Permalink
Meta: do not create release when there are no public changes (wfxr#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlfriedrich authored Nov 4, 2024
1 parent 60b651d commit 2d5f8f4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/scripts/changelog.sh
Original file line number Diff line number Diff line change
@@ -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~)
Expand All @@ -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
3 changes: 3 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 2d5f8f4

Please sign in to comment.