Skip to content

feat: auto-sync readme.txt changelog and version on release - #50

Merged
jackgranatowski merged 7 commits into
mainfrom
claude/affectionate-shannon-nh8sjw
Jun 19, 2026
Merged

feat: auto-sync readme.txt changelog and version on release#50
jackgranatowski merged 7 commits into
mainfrom
claude/affectionate-shannon-nh8sjw

Conversation

@jackgranatowski

@jackgranatowski jackgranatowski commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • changelog-release.js now mirrors each promoted version entry into readme.txt == Changelog == in WP.org format (= X.Y.Z = with * Added: / * Changed: / * Fixed: bullets), generated from the same conventional commits as CHANGELOG.md
  • release.yml: moved the changelog-release step to run before build:zip so the distributed zip always contains the fully up-to-date readme.txt
  • release.yml: the commit-back step now stages both CHANGELOG.md and SLASHED-for-WP/readme.txt so both are pushed to main after a release
  • readme.txt: fixed changelog entry 0.0.10.3.0, removed the internal REST API section and the currently-disabled Design Settings section

Release flow after this PR

When a version tag (e.g. v0.4.0) is pushed:

  1. version-sync --from-tag stamps Stable tag, Version: headers, and PHP constants
  2. changelog-release.js --from-tag promotes [Unreleased] in CHANGELOG.md and prepends = 0.4.0 = to readme.txt == Changelog ==
  3. build:zip packages the zip — readme.txt is already up to date inside it
  4. Both CHANGELOG.md and readme.txt are committed back to main

Test plan

  • Push a test tag and confirm the zip contains readme.txt with the correct = X.Y.Z = entry under == Changelog ==
  • Confirm CHANGELOG.md and readme.txt are both committed back to main by the release workflow
  • Confirm Stable tag in readme.txt matches the tag version

Generated by Claude Code


Summary by cubic

Auto-syncs the WP.org readme.txt changelog from the promoted CHANGELOG.md entry on release, and runs before packaging so the published zip always has the latest notes.

  • New Features

    • scripts/changelog-release.js mirrors each promoted version into SLASHED-for-WP/readme.txt under == Changelog == in WP.org format (= X.Y.Z =), converting the merged CHANGELOG.md body (includes manual notes).
    • release.yml runs the sync before build:zip and commits CHANGELOG.md and readme.txt back to the default branch.
  • Bug Fixes

    • Sync derives entries from the merged changelog body and preserves free-form lines and numbered lists, so manual [Unreleased] notes are kept.
    • Eliminated a TOCTOU race and made the readme sync idempotent.
    • Hardened error handling: only suppress ENOENT for missing readme.txt; re-throw other errors so the release fails visibly.
    • Added JSDoc to all helper functions in scripts/changelog-release.js for clarity.

Written for commit 629de00. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Documentation

    • Restructured README with reordered sections for improved clarity.
    • Added version 0.3.0 changelog entry marking the initial public release.
  • Chores

    • Enhanced release workflow to automatically synchronize changelog and documentation updates.

claude added 2 commits June 19, 2026 17:45
- changelog-release.js now mirrors each promoted version entry into
  readme.txt == Changelog == in WP.org format (Added/Changed/Fixed bullets)
- release.yml: move changelog-release step before build:zip so the zip
  always contains the up-to-date readme.txt
- release.yml: commit both CHANGELOG.md and readme.txt back to main
- Fix readme.txt: changelog entry 0.0.1 → 0.3.0, remove REST API and
  Design Settings sections (already staged)
Comment thread scripts/changelog-release.js Fixed

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found and verified against the latest diff

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread scripts/changelog-release.js Outdated
Previously syncReadmeChangelog re-derived entries from the auto-generated
commit categorisation, ignoring any manual entries written in [Unreleased].
Now it converts the authoritative mergedBody (what was actually written to
CHANGELOG.md) so readme.txt always mirrors the same content.
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The release script gains two new helpers—changelogBodyToReadmeLines and syncReadmeChangelog—to parse and mirror promoted CHANGELOG.md content into SLASHED-for-WP/readme.txt during the promote flow. The CI release workflow is updated to stage and commit both files together with an updated step order and commit message. readme.txt is also updated with a repositioned section and a new 0.3.0 changelog entry.

Changes

WP readme.txt changelog sync

Layer / File(s) Summary
Changelog-to-readme conversion and sync logic
scripts/changelog-release.js
Adds README path constant, changelogBodyToReadmeLines() to translate ### Section / - bullet markdown into WP readme * Section: text format, and syncReadmeChangelog(version, mergedBody) to idempotently prepend a new version entry at == Changelog ==. In promote mode, calls syncReadmeChangelog after CHANGELOG.md is updated.
CI workflow wiring and readme.txt content update
.github/workflows/release.yml, SLASHED-for-WP/readme.txt
Reorders the changelog/readme step to run earlier in the job, renames the commit step, stages both CHANGELOG.md and SLASHED-for-WP/readme.txt, skips the commit when the staged diff is empty, and updates the commit message. Also repositions the "CSS delivery" section and adds the manually authored 0.3.0 changelog entry in readme.txt.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: automatic synchronization of readme.txt changelog during releases.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/affectionate-shannon-nh8sjw

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/changelog-release.js`:
- Around line 162-179: The loop that processes changelog lines only captures
section headers (lines matching the ###\s+ pattern) and bullet points (lines
matching ^[-*]\s+ pattern), but ignores any free-form text lines that don't
match these patterns. To fix this, add an additional condition after the
bulletMatch check to handle lines that are neither section headers nor bullet
points. For any remaining non-empty lines that don't match the sectionMatch or
bulletMatch patterns, add them to the lines array with appropriate formatting
(prepending with * if needed) so that free-form content in the [Unreleased]
section is preserved and included in the readme sync output.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: aafe0785-0fb5-492e-9c6d-295431c3841a

📥 Commits

Reviewing files that changed from the base of the PR and between c0c92e0 and 8ff7616.

📒 Files selected for processing (3)
  • .github/workflows/release.yml
  • SLASHED-for-WP/readme.txt
  • scripts/changelog-release.js

Comment thread scripts/changelog-release.js
…SDoc

- changelogBodyToReadmeLines: also match numbered lists and bare free-form
  text lines so manually written [Unreleased] entries are not silently dropped
- Add JSDoc to mergeBody() and main() to satisfy 80% docstring coverage threshold

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 1 file (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Fix all with cubic | Re-trigger cubic

Comment thread scripts/changelog-release.js Outdated
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.

3 participants