Skip to content

Update mkdocs.yml

Update mkdocs.yml #38

Workflow file for this run

name: Generate Changelog
on:
push:
branches: [main]
workflow_dispatch: # Allow manual triggering
jobs:
changelog:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history for changelog generation
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install git-cliff
uses: taiki-e/install-action@v2
with:
tool: git-cliff
- name: Check for changes since last changelog update
id: check_changes
run: |
# Check if this commit is a changelog update commit
CURRENT_COMMIT_MSG=$(git log -1 --format="%s")
if [[ "$CURRENT_COMMIT_MSG" == *"docs: update changelog"* ]]; then
echo "Current commit is a changelog update, skipping"
echo "has_changes=false" >> $GITHUB_OUTPUT
exit 0
fi
# Always generate changelog for non-changelog commits
# This ensures we capture all changes and git-cliff will handle duplicates
echo "Non-changelog commit detected, generating changelog"
echo "has_changes=true" >> $GITHUB_OUTPUT
- name: Generate changelog
if: steps.check_changes.outputs.has_changes == 'true'
run: |
echo "Generating changelog..."
git-cliff --output CHANGELOG.md
- name: Check if changelog was updated
if: steps.check_changes.outputs.has_changes == 'true'
id: check_diff
run: |
if git diff --quiet CHANGELOG.md; then
echo "No changes to changelog"
echo "changelog_updated=false" >> $GITHUB_OUTPUT
else
echo "Changelog was updated"
echo "changelog_updated=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push changelog
if: steps.check_changes.outputs.has_changes == 'true' && steps.check_diff.outputs.changelog_updated == 'true'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add CHANGELOG.md
git commit -m "docs: update changelog [skip ci]"
git push