-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backport tools: sort PRs to be cherry picked by merged/closed date #52667
Conversation
…closed PRs to most recently closed PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've never used this command before myself, so others might have more input, but this looks like a terrific idea to me! And thanks for the helpful test instructions that meant I didn't accidentally auto-comment on a bunch of PRs 😄
✅ Confirmed that this results in the PRs array being sorted by merged_at
date from oldest (further back in time of merge date) to most recently merged
✅ Fallback to root closed_at
value looks good
LGTM! ✨
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! This change should avoid about 90% of merge conflicts during cherry-picking 🎉
Thanks for reviewing, folks! 🙇🏻 |
Let's add this PR to the |
…52667) * Sorting found PRs by closed date in ascending order, from the oldest closed PRs to most recently closed PRs. * Now checking pull_request?.merged_at * Now checking pull_request?.merged_at * semi colon
I have committed this PR's merge commit d1f763c to the wp/6.3 branch |
* trunk: (36 commits) Use `_get_block_template_file` function and set $area variable. (#52708) Change Delete page menu item to Move to trash. (#52641) Search block: Enqueue view script through block.json (#52552) Patterns: fix bug with Create Patterns menu not showing in site editor page editing (#52671) Github workflow: add a PHP backport changes action (#52096) Add layout API documentation. (#52673) Show uncategorized patterns on the Editor > Patterns page (#52633) Patterns: Remove `reusable` text from menu once rename hint has been dismissed (#52664) Update locked pattern tooltips (#52497) Rich Text/Footnotes: fix getRichTextValues for useInnerBlocksProps.save (#52682) Use posts instead of template parts for navigation color tests (#52654) Site Editor: Don't allow creating template part on the Patterns page for non-block themes (#52656) Site Editor: Fix incorrect 'useSelect' usage (#52683) Update issue gardening automation with new label (#52173) i18n: Make the tab labels of `ColorGradientSettingsDropdown` component translatable (#52669) Post Content link color should not be applied to placeholder component links (#52367) [Mobile] Update toolbar icons and colors (#52336) Avoid copying global style presets via the styles compatibility hook (#52640) Show warning on removal of Post Template block in the site editor. (#52666) Backport tools: sort PRs to be cherry picked by merged/closed date (#52667) ...
What?
Updates the
npm run other:cherry-pick
script.When fetching PRs to be cherry picked, first sort them by
pull_request.merged_at
(andclosed_at
if not available) date in ascending order, that is, from the oldest merged/closed PRs to most recently merged/closed PRs.Before (last_update updated descending)
After (sorted by merged ascending)
Why?
At the moment the script fetches PR according with an "updated" sort flag. These means that the PRs are ordered by the last updated date, with the most-recent item first.
When cherry-picking commits there's always a risk of merge conflicts - hopefully cherry-picking commits from oldest to most recent merge dates will reduce the likelihood of conflicts.
The assumption is that applying newer commits to older ones will better reflect how the current state of the code should be as newer commits may have modified code in the older commits.
Conversely, applying an older commit to a newer commit could lead to merge conflicts where the older commit contains code that has been modified by the newer commit.
How?
Sorting by dates available from the Github API response.
Testing Instructions
You can test against any set of Gutenberg PR labels by running
npm run other:cherry-pick "LABEL_NAME"
npm run other:cherry-pick
alone will run against the "Backport to WP Beta/RC" label.To test, I commented out most of the functionality and print out fetched PRs to check the order:
Diff