Skip to content

fix(changelog): fetching main first #22

fix(changelog): fetching main first

fix(changelog): fetching main first #22

Workflow file for this run

name: ChangeLog generation
on:
workflow_dispatch:
push:
tags:
- 'v*'
jobs:
generate:
runs-on: "ubuntu-latest"
steps:
- name: Check out repo
uses: actions/checkout@v4
with:
fetch-tags: true
fetch-depth: 0
repository: "Govcraft/rust-docs-mcp-server"
- name: Generate and Commit Changelog
run: |
# Create a temporary directory for extraction
mkdir chglog_tmp
# Download git-chglog archive
wget https://github.com/git-chglog/git-chglog/releases/download/v0.15.4/git-chglog_0.15.4_linux_amd64.tar.gz
# Extract into the temporary directory
tar -xvzf git-chglog_0.15.4_linux_amd64.tar.gz -C chglog_tmp
# Generate changelog using the extracted executable
./chglog_tmp/git-chglog -o ./CHANGELOG.md
# Clean up downloaded archive and temporary directory
rm git-chglog_0.15.4_linux_amd64.tar.gz
rm -rf chglog_tmp
# Configure git user
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Fetch the main branch to ensure local ref is up-to-date
git fetch origin main
# Checkout main branch
git checkout main
# Add, commit, and push the changelog to main
git add ./CHANGELOG.md
# Use --allow-empty in case the changelog hasn't changed (e.g., rerunning on same tag)
git commit --allow-empty -m "chore(docs): update CHANGELOG for latest tag [skip ci]"
git push origin main