Skip to content

Live Branches: Support GitHub's new pull request page layout - #54851

Merged
jeherve merged 1 commit into
trunkfrom
fix/live-branches-new-pr-page
Nov 12, 2026
Merged

jeherve merged 1 commit into
trunkfrom
fix/live-branches-new-pr-page

Conversation

@jeherve

@jeherve jeherve commented Nov 12, 2026

Copy link
Copy Markdown
Member

Proposed changes

GitHub now shows some people a new pull request page, built in React. On that page the Jetpack Live Branches userscript shows nothing at all: it looks for the PR description inside .pull-discussion-timeline, and that wrapper no longer exists. The labels moved too, into a sidebar list without the IssueLabel class or data-name attribute, so even with the description found, no plugin would have been ticked by default.

This PR updates the script so it finds both, whichever layout you get:

  • The PR description is now also found with section[aria-label="Description"] .markdown-body.
  • A new getPRLabels() reads label names from the classic sidebar and from the new section[aria-label="Labels"], so plugins are still ticked based on the PR's [Plugin] … labels.

I bumped the version to 1.39 so Tampermonkey picks up the update.

The new selectors rely on aria-labels rather than class names, since the new layout's classes are hashed (body__fphukB, container__qcj0r_) and will likely change with GitHub's next build. The branch name and PR state already came from the page's embedded JSON (#46958), which both layouts still provide, so that part didn't need to change.

Related product discussion/links

Does this pull request change what data or activity we track or use?

No.

Testing instructions

You'll need the userscript installed in Tampermonkey, or a similar extension.

  1. Replace your installed copy of the script with the version from this branch (or paste it into Tampermonkey's editor). Check it reports version 1.39.
  2. With the new PR page layout, open an open PR with built plugins, for example Backup: remove the four REST routes only the legacy dashboard called #53859.
    • The "Jetpack Live Branches" section should appear at the end of the PR description.
    • Expand the options. Plugins matching the PR's [Plugin] … labels should be ticked (Jetpack and Jetpack Backup on Backup: remove the four REST routes only the legacy dashboard called #53859), plugins with a build but no label available but unticked (Jetpack Protect), and the rest greyed out.
    • Ticking or unticking a plugin should update the Jurassic Ninja link below the options.
  3. Open a merged PR, for example Premium Analytics: Open Stats v2 for page=stats when WordPress 7.2 reports it as not found #54800. You should get "This branch is already merged" with a link to test trunk instead.
  4. Switch back to the classic PR page and repeat steps 2 and 3. The result should be the same as on trunk.

I ran steps 2 and 3 on the new layout. Tampermonkey wasn't installed in that browser, so I injected the script into the page by hand and fed it a saved query-branch.php response. I haven't run step 4 on the classic layout yet; I'll do that with the real Tampermonkey install before asking for review.

GitHub now serves some users a React-based PR page that has no
`.pull-discussion-timeline` wrapper, so the script found no PR body and
rendered nothing. Labels moved as well, into a sidebar section of Primer
tokens without the `IssueLabel` class or `data-name` attribute, which
would have left every plugin unchecked by default.

Match the PR body and labels in both layouts. The new selectors key on
`aria-label` rather than the layout's hashed class names, which are
unlikely to survive GitHub's next build. Branch and state already come
from the embedded JSON, which both layouts provide.
@jeherve
jeherve requested a review from a team as a code owner November 12, 2026 09:21
@jeherve jeherve self-assigned this Nov 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@jeherve
jeherve merged commit 9914474 into trunk Nov 12, 2026
84 checks passed
@jeherve
jeherve deleted the fix/live-branches-new-pr-page branch November 12, 2026 09:34
Comment on lines +140 to +145
const labels = new Set(
$.map( $( '.js-issue-labels a.IssueLabel' ), e => $( e ).data( 'name' ) )
);
$( 'section[aria-label="Labels"] a[href*="label%3A"]' ).each( ( i, e ) => {
labels.add( e.textContent.trim() );
} );

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If we're going to trust textContent, you could probably have simplified this a bit

Suggested change
const labels = new Set(
$.map( $( '.js-issue-labels a.IssueLabel' ), e => $( e ).data( 'name' ) )
);
$( 'section[aria-label="Labels"] a[href*="label%3A"]' ).each( ( i, e ) => {
labels.add( e.textContent.trim() );
} );
const labels = new Set(
$.map( $( '.js-issue-labels a.IssueLabel, section[aria-label="Labels"] a[href*="label%3A"]' ), e => e.textContent.trim() )
);

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.

2 participants