Skip to content

Conversation

@theaminulai
Copy link
Member

@theaminulai theaminulai commented Jan 15, 2026

Fixes #153

What

This PR adds automatic changelog generation that updates readme.txt in WordPress plugin format when milestones are closed or manually triggered.

Why

After #152 established proper milestone assignment for PRs, we needed automation to generate changelogs from those milestones. Manual changelog writing is time-consuming and error-prone. This automation:

  • Saves time during release preparation
  • Ensures consistency in changelog formatting
  • Reduces errors by automatically categorizing changes
  • Integrates with existing workflow (milestone automation from Add milestone automation for merged PRs #356)
  • Follows WordPress standards for plugin readme.txt format

How

Workflow Triggers

The changelog generator runs in two scenarios:

  1. Automatically when a milestone is closed
  2. Manually via workflow dispatch with optional dry-run mode

Process Flow

graph TD
    A[Milestone Closed] --> B[Fetch Milestone Info]
    B --> C[Get All Merged PRs]
    C --> D[Categorize by Labels]
    D --> E[Generate Changelog Entry]
    E --> F[Update readme.txt]
    F --> G[Commit & Push to Trunk]

Categorization

PRs are automatically grouped by labels:

Label Changelog Section
[Type] Feature Features
[Type] Enhancement Enhancements
[Type] Bug Fixes
documentation Documentation
[Type] Project Management Project Management

Files Created

.github/workflows/changelog-generator.yml
bin/generate-changelog.php
bin/update-readme-changelog.php

Files Changed

composer.json
Added script entry for manual changelog generation:

"scripts": {
  "changelog:generate": "php bin/generate-changelog.php"
}

This allows developers to manually generate changelogs when needed.

Usage Examples

Automatic (Milestone Close)

  1. Merge PRs with proper labels and milestones
  2. Close the milestone when ready to release
  3. Workflow automatically runs and updates readme.txt
  4. Changes are committed to trunk

Via GitHub UI:

  1. Navigate to Actions → Generate Changelog
  2. Click "Run workflow"
  3. Enter milestone number or title
  4. Check "Preview changelog without committing" for dry-run
  5. Click "Run workflow"

Testing Checklist

Before merging, verify:

  • Workflow triggers on milestone close
  • Manual workflow dispatch works with milestone input
  • PRs are correctly categorized by labels
  • Changelog format matches existing readme.txt style
  • New entries insert at correct position (top of changelog)
  • Date formatting works from milestone due date
  • Fallback to current date when no due date set
  • PR title cleaning removes common prefixes
  • Empty categories are skipped
  • Error handling works for missing files/data

This script generates a changelog entry from milestone PRs, categorizing them by labels and formatting the output for a specified release date.
This script updates the readme.txt file with a new changelog entry from a specified file. It checks for the existence of the readme and changelog entry files before proceeding with the update.
@theaminulai theaminulai marked this pull request as ready for review January 15, 2026 02:37
Copilot AI review requested due to automatic review settings January 15, 2026 02:37
@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @hrishikesh2810.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

Core Committers: Use this line as a base for the props when committing in SVN:

Props theaminuldev, priethor.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements automatic changelog generation for the WordPress plugin's readme.txt file. When milestones are closed or manually triggered, the system fetches associated merged PRs, categorizes them by labels, and generates properly formatted changelog entries.

Changes:

  • Added GitHub Actions workflow to trigger changelog generation on milestone close or manual dispatch
  • Created PHP scripts to generate changelog entries from milestone PR data and insert them into readme.txt
  • Added Composer script entry for manual changelog generation

Reviewed changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 8 comments.

File Description
.github/workflows/changelog-generator.yml GitHub Actions workflow that orchestrates the changelog generation process
bin/generate-changelog.php PHP script that fetches milestone PRs and formats them into WordPress changelog entries
bin/update-readme-changelog.php PHP script that inserts generated changelog entries into readme.txt
composer.json Adds composer script entry for manual changelog generation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

theaminulai and others added 5 commits January 15, 2026 18:44
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automatic changelog generation

1 participant