Skip to content
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

Update PHP Sync Issue generation script to ignore PRs with given labels #59549

Merged
merged 6 commits into from Mar 13, 2024

Conversation

getdave
Copy link
Contributor

@getdave getdave commented Mar 4, 2024

What?

Updates the script which generates the list of PRs requiring manual backporting to WP Core for a given release to ignore PRs with known labels.

Why?

As part of changes to the process for syncing Gutenberg to WP Core we now add a Backported to WP Core label to any PRs that have been backported. This is done either manually or automatically via the Cherry Picking script.

As a result, we should update the script to ignore any PRs that have this label as we know they have already been backported to Core.

As a consequence we can also remove the lastRcDate required arg as this was a temp hack in place during 6.5 because the PRs from the 6.4 cycle didn't have the Backported to WP Core label (as this convention was adopted only during the 6.5 release).

How?

  • Fetches full PR info for all commits
  • Checks labels and omits any PRs which don't need to be processed based on those labels
  • Updates labels to include the Backported to WP Core label.
  • A few other tweaks

Testing Instructions

  • Get GH token
  • Run script:
node bin/generate-php-sync-issue.mjs --token=YOUR_TOKEN_HERE --since=2023-09-23  --wpstable=6.4
  • Check that PRs listed do not have the Backported to WP Core label
  • Check that PRs listed do not have the Backport from WordPress Core label

Testing Instructions for Keyboard

Screenshots or screencast

@getdave getdave added Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts [Type] Code Quality Issues or PRs that relate to code quality labels Mar 4, 2024
@getdave getdave self-assigned this Mar 4, 2024

// The following paths will be ignored when generating the issue content.
const IGNORED_PATHS = [
'init.php', // plugin specific code.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this to path ignore as I don't think we need to worry about code here.

const LABELS_TO_IGNORE = [ 'Backport from WordPress Core' ];
const LABELS_TO_IGNORE = [
'Backport from WordPress Core', // PRs made "upstream" in Core that were synced back into Gutenberg.
'Backported to WP Core', // PRs that were synced into Core during a previous release.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the new label that indicates a given PR has already been backported to WP Core and so any PRs with this label can be safely omitted from the list of PRs that will need to be manually backported to Core in the next release cycle (at the time of authoring that will be WP 6.6).

@@ -466,7 +439,7 @@ function generateIssueContent( result, level = 1 ) {
}

async function fetchAllCommits( since, path ) {
return await octokitPaginate( 'GET /repos/{owner}/{repo}/commits', {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need to await inside an async function as return value will always be an awaitable Promise.

@@ -481,7 +454,7 @@ async function fetchCommit( sha ) {

// eslint-disable-next-line no-unused-vars
async function getPullRequestDataForCommit( commitSha ) {
const pullRequests = octokitRequest(
const pullRequests = await octokitRequest(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to await here to ensure we get the data 😅

@getdave getdave requested a review from youknowriad March 4, 2024 12:39
@getdave getdave marked this pull request as ready for review March 4, 2024 12:39
Copy link

github-actions bot commented Mar 4, 2024

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: getdave <get_dave@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>

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

@getdave
Copy link
Contributor Author

getdave commented Mar 12, 2024

@youknowriad Could we get this merged do you think? Without these changes this script will be less useful to future contributors and I'd like to update the handbook.

@getdave getdave requested a review from scruffian March 12, 2024 16:09

This comment was marked as off-topic.

@getdave getdave merged commit 4a26fa4 into trunk Mar 13, 2024
58 checks passed
@getdave getdave deleted the update/php-issue-sync-script-label-ignoring branch March 13, 2024 07:57
@github-actions github-actions bot added this to the Gutenberg 18.0 milestone Mar 13, 2024
carstingaxion pushed a commit to carstingaxion/gutenberg that referenced this pull request Mar 27, 2024
…ls (WordPress#59549)

* Fetch full PR data and interogate labels

* Revert change to const

* Remove redundant comments

* Remove debugging

* Remove redundant arg

* Add new script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts [Type] Code Quality Issues or PRs that relate to code quality
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants