Skip to content

Commit

Permalink
👷 chore: Add script to generate changelog
Browse files Browse the repository at this point in the history
Create a new Bash script to automate changelog generation
using Git commit history. The script labels commit types with
GitMoji icons and outputs the changelog to a file named `CHANGELOG`.
  • Loading branch information
Sorok-Dva committed Aug 16, 2024
1 parent ebe45fb commit 1f7a7aa
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions generate-changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

# Récupère le dernier tag
last_tag=$(git describe --tags --abbrev=0)

# Vérifier le dernier tag
echo "Dernier tag : $last_tag"

# Génère le changelog depuis le dernier tag
git log $last_tag..HEAD --pretty=format:"- %s (%h)" > CHANGELOG_RAW

# Vérifier si des commits ont été trouvés
if [ ! -s CHANGELOG_RAW ]; then
echo "Aucun commit trouvé depuis le dernier tag."
exit 1
fi

# Remplacer les types de commit par leur icône correspondante
sed -i '' "s/^fix/🔧 fix/g; s/^feat/✨ feat/g; s/^chore/🔖 update/g; s/^refactor/♻️ refactor/g; s/^docs/📝 docs/g; s/^style/💄 style/g; s/^test/✅ test/g" CHANGELOG_RAW

# Renommer le fichier final
mv CHANGELOG_RAW CHANGELOG

echo "Changelog généré dans le fichier CHANGELOG"

0 comments on commit 1f7a7aa

Please sign in to comment.