Skip to content

Commit 65c200e

Browse files
doobidooHeinrich Kruppclaude
authored
chore: add automated changelog housekeeping workflow (#578)
* chore: add automated changelog housekeeping workflow Monthly GitHub Actions workflow + Python script that archives older CHANGELOG.md entries to docs/archive/CHANGELOG-HISTORIC.md and trims README "Previous Releases" section. Supports --dry-run and validates no versions are lost during archival. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: prevent changelog housekeeping from truncating README after releases - Section detection now matches **Previous Releases**: (bold text) in addition to # header format — fixes detection for current README - Section end detection recognizes --- (horizontal rules) and **Full version history** footer, not just markdown headers - Prevents content after Previous Releases (Migration, Documentation, Contributing sections) from being lost during trimming Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: address code review findings for changelog housekeeping - Fix archive boundary: use newest_archived version instead of oldest_kept for "Versions vX.Y.Z and earlier" header reference - Add footer link injection when Previous Releases is the last section - Remove unused total_after variable - Pin peter-evans/create-pull-request to SHA for supply-chain security Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Heinrich Krupp <hkr@Mac-mini-von-Heinrich.local> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4193c6a commit 65c200e

File tree

2 files changed

+472
-0
lines changed

2 files changed

+472
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Changelog Housekeeping
2+
3+
on:
4+
schedule:
5+
# Runs at 09:00 UTC on the 1st of every month
6+
- cron: '0 9 1 * *'
7+
workflow_dispatch: # Allow manual trigger
8+
9+
jobs:
10+
housekeeping:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pull-requests: write
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.12'
24+
25+
- name: Run changelog housekeeping
26+
id: housekeeping
27+
run: |
28+
python scripts/maintenance/changelog_housekeeping.py 2>&1 | tee /tmp/housekeeping.log
29+
EXIT_CODE=${PIPESTATUS[0]}
30+
31+
# Check if changes were made
32+
if git diff --quiet; then
33+
echo "changes=false" >> $GITHUB_OUTPUT
34+
echo "No changes needed"
35+
else
36+
echo "changes=true" >> $GITHUB_OUTPUT
37+
38+
# Extract oldest kept version for branch/commit naming
39+
OLDEST=$(grep -oP 'Oldest version in CHANGELOG\.md: v\K[\d.]+' /tmp/housekeeping.log || echo "unknown")
40+
echo "oldest_version=$OLDEST" >> $GITHUB_OUTPUT
41+
fi
42+
43+
exit $EXIT_CODE
44+
45+
- name: Create Pull Request
46+
if: steps.housekeeping.outputs.changes == 'true'
47+
uses: peter-evans/create-pull-request@67ccf5d5e48bc43b8d67988607b5fdaee1b0f4b8 # v7.0.6
48+
with:
49+
token: ${{ secrets.GITHUB_TOKEN }}
50+
commit-message: "chore: archive changelog entries older than v${{ steps.housekeeping.outputs.oldest_version }}"
51+
title: "chore: changelog housekeeping — archive older entries"
52+
body: |
53+
## Automated Changelog Housekeeping
54+
55+
This PR was created automatically by the [changelog-housekeeping workflow](../.github/workflows/changelog-housekeeping.yml).
56+
57+
**What changed:**
58+
- Archived older CHANGELOG.md entries to `docs/archive/CHANGELOG-HISTORIC.md`
59+
- Kept last 8 versions in CHANGELOG.md
60+
- Trimmed README.md "Previous Releases" section (max 7 entries)
61+
62+
**Validation:** The script verified that no version entries were lost during archival.
63+
64+
---
65+
*Triggered: ${{ github.event_name == 'schedule' && 'monthly schedule' || 'manual dispatch' }}*
66+
branch: chore/changelog-housekeeping
67+
delete-branch: true
68+
labels: |
69+
maintenance
70+
documentation
71+
assignees: doobidoo

0 commit comments

Comments
 (0)