Skip to content

Commit

Permalink
fix changelog.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Johanna Bahl committed Dec 13, 2024
1 parent f20b923 commit 462ee09
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion changelog.d/scriv.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[scriv]
format = md
entry_title_template =
categories = Impact, NixOS platform
categories = Impact, NixOS XX.XX platform
output_file = changelog.d/CHANGELOG.md.tmp
skip_fragments = CHANGELOG.*
18 changes: 15 additions & 3 deletions changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,20 @@

set -e

if [ -z "$EDITOR" ]; then
echo "Error: \$EDITOR is not set or empty"
exit 1
fi

base="./changelog.d"
branch=$(git rev-parse --abbrev-ref HEAD)

new_item="${base}/$(date '+%Y%m%d_%H%M%S')_${branch/\//-}_scriv.md"
template="${base}/new_fragment.md.j2"

cp "$template" "$new_item"

new_item="${base}/$(date '+%Y%m%d_%H%M%S')_$(git rev-parse --abbrev-ref HEAD)_scriv.md"
cp "${base}/new_fragment.md.j2" ${new_item}
$EDITOR $new_item
if ! $EDITOR "$new_item" || diff -q "$template" "$new_item" > /dev/null; then
echo "Editor failed or content not changed. Deleting fragment..."
rm "${new_item}"
fi

0 comments on commit 462ee09

Please sign in to comment.