feat(handler): populate the handler with new source #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate Versioned Changelog | |
on: | |
push: | |
branches: | |
- main | |
- master | |
workflow_dispatch: | |
jobs: | |
changelog: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Ensure full commit history is fetched, including all tags | |
- name: Get list of tags | |
id: tags | |
run: | | |
git fetch --tags | |
# Get all tags and sort them by version in reverse order | |
tags=$(git tag -l | sort -V) # Use sort -V to sort tags based on version numbers | |
echo "Tags found: $tags" # For debugging | |
echo "::set-output name=tags::$tags" # Pass tags to the next step | |
- name: Generate Changelog | |
run: | | |
echo "# Changelog" > CHANGELOG.md | |
echo "" >> CHANGELOG.md | |
# Initialize previous tag variable | |
prev_tag="" | |
for tag in ${{ steps.tags.outputs.tags }}; do | |
if [ -z "$prev_tag" ]; then | |
# First tag, include all commits up to this tag | |
echo "## $tag" >> CHANGELOG.md | |
git log --pretty=format:"- %h %s (%an, %ad)" --date=short $tag >> CHANGELOG.md | |
else | |
# Subsequent tags, get commits between previous tag and current tag | |
echo "## $tag" >> CHANGELOG.md | |
git log --pretty=format:"- %h %s (%an, %ad)" --date=short $prev_tag..$tag >> CHANGELOG.md | |
fi | |
prev_tag=$tag # Update previous tag for the next iteration | |
done | |
- name: Commit and Push Changelog | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git add CHANGELOG.md | |
git commit -m "docs: update changelog [skip ci]" | |
git push origin ${{ github.ref }} |