Skip to content

fix(changelog): creating local branch #23

fix(changelog): creating local branch

fix(changelog): creating local branch #23

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 latest main branch from origin
# Use refs/heads/main to be explicit about fetching the branch, not a tag named main
git fetch origin refs/heads/main
# Create a new branch based on the fetched origin/main
git checkout -b changelog-update origin/main
# Add, commit the changelog to the new branch
git add ./CHANGELOG.md
git commit --allow-empty -m "chore(docs): update CHANGELOG for latest tag [skip ci]"
# Push the new local branch to the remote main branch
git push origin changelog-update:main