Skip to content

Instantly share code, notes, and snippets.

@lionel-rowe
Last active October 13, 2025 10:08
Show Gist options
  • Select an option

  • Save lionel-rowe/472d3de7738494746e5015d31220b748 to your computer and use it in GitHub Desktop.

Select an option

Save lionel-rowe/472d3de7738494746e5015d31220b748 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Revert GitHub PR Title Truncation
// @namespace https://github.com/lionel-rowe/
// @version 0.3
// @description Revert GitHub PR Title Truncation
// @author https://github.com/lionel-rowe/
// @match https://github.com/*/compare/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=github.com
// @grant none
// ==/UserScript==
// https://github.com/orgs/community/discussions/12450
const ELLIPSIS = '…'
untruncate()
new MutationObserver(untruncate).observe(document.body, { childList: true, subtree: true })
function untruncate() {
if (!location.pathname.includes('/compare/')) return
const $title = document.getElementsByName('pull_request[title]')[0]
const $body = document.getElementsByName('pull_request[body]')[0]
if ($title == null || $body == null) return
if ($title?.value.endsWith(ELLIPSIS) && $body?.value.startsWith(ELLIPSIS)) {
const [first, ...rest] = $body.value.split('\n')
$title.value = $title.value.slice(0, -ELLIPSIS.length) + first.slice(ELLIPSIS.length)
$body.value = [...rest].join('\n').trimStart()
}
}
@StefanMich
Copy link

Title gets wrong when a PR tempate is used

  • $title.value = $title.value.slice(0, -ellipsis.length) + $body.value.slice(ellipsis.length)
  • $title.value = $title.value.slice(0, -ellipsis.length) + first.slice(ellipsis.length)

@lionel-rowe
Copy link
Author

Title gets wrong when a PR tempate is used

  • $title.value = $title.value.slice(0, -ellipsis.length) + $body.value.slice(ellipsis.length)

  • $title.value = $title.value.slice(0, -ellipsis.length) + first.slice(ellipsis.length)

Thanks @StefanMich ! Updated with that fix and a couple of other changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment