Skip to content

Automatically assign plugin-specific milestones on pull requests.#2593

Open
dilipom13 wants to merge 2 commits into
WordPress:trunkfrom
dilipom13:maintenance/auto-plugin-milestone
Open

Automatically assign plugin-specific milestones on pull requests.#2593
dilipom13 wants to merge 2 commits into
WordPress:trunkfrom
dilipom13:maintenance/auto-plugin-milestone

Conversation

@dilipom13

Copy link
Copy Markdown

Summary

Fixes #2541

Implements automatic assignment of a plugin-specific milestone when a pull request is opened or updated. The workflow counts changed lines under each plugins/<slug>/ path, picks the plugin with a unique highest total, and sets the milestone (preferring <slug> n.e.x.t when it exists). Related to the existing plugin label automation in .github/workflows/add-pr-labels.yml.

Note: PR #2586 addresses the same issue; this branch was prepared locally for testing and to offer help with review or follow-up fixes if maintainers prefer.

Relevant technical choices

  • Milestone assignment runs in the same pull_request_target workflow as plugin labels, using actions/github-script and shared logic in bin/plugin/lib/assign-plugin-milestone.js.
  • Pull request files are fetched via the GitHub API (no checkout of the contributor branch for assignment logic).
  • Cross-plugin renames count additions toward the destination plugin and deletions toward the source plugin.
  • If the PR already has a milestone for the selected plugin, it is left unchanged.
  • Ties or ambiguous open milestones leave the milestone unchanged and log an informational message.
  • Adds npm run test-unit-js (node --test) and runs it in the JS lint workflow.
  • The optional changelog-label enhancement from Add workflow to automatically assign milestone #2541 is out of scope for this change.

Use of AI Tools

No AI tools were used to author the code changes. AI was not used to write the implementation.

@github-actions

github-actions Bot commented Jul 25, 2026

Copy link
Copy Markdown

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.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: dilipom13 <dilip2615@git.wordpress.org>
Co-authored-by: mukeshpanchal27 <mukesh27@git.wordpress.org>
Co-authored-by: westonruter <westonruter@git.wordpress.org>

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

@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.35%. Comparing base (0a51c32) to head (4b78e82).

Additional details and impacted files
@@           Coverage Diff           @@
##            trunk    #2593   +/-   ##
=======================================
  Coverage   70.35%   70.35%           
=======================================
  Files          91       91           
  Lines        7867     7867           
=======================================
  Hits         5535     5535           
  Misses       2332     2332           
Flag Coverage Δ
multisite 70.35% <ø> (ø)
single 35.17% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +63 to +64
- name: JS Unit Tests
run: npm run test-unit-js

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What is reasons behind this new script?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

What is reasons behind this new script?

Hello @mukeshpanchal27, good question thanks for asking.

This PR adds bin/plugin/lib/assign-plugin-milestone.js with unit tests in assign-plugin-milestone.test.js.
Those tests use Node’s built-in test runner (node:test), not PHPUnit or Playwright.

The new test-unit-js script in package.json is a small wrapper so contributors and CI can run them the same way:

npm run test-unit-js

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.

Add workflow to automatically assign milestone

2 participants