Credits to @jareware for the original code, I made small modifications to the script.
Paste the following code in Bookmarkleter and follow instructions how to setup the bookmark.
(() => {
const key = (location.href.match(/selectedIssue=([A-Z]+-\d+)$/) || [])[1]
if (!key) return alert('Error: URL does not look right')
const h1 = document.querySelectorAll('div[role=dialog] h1')
if (h1.length < 1) return alert('Error: DOM does not look right')
const title = h1[0].innerText.toLowerCase()
.replace(/[^a-z]+/g, '-')
.replace(/(^-|-$)/g, '')
const branchName = key.toLowerCase() + '-' + title.split('-').slice(0, 5).join('-');
navigator.clipboard.writeText(branchName).then(() => {
alert('Copied to clipboard: ' + branchName);
}).catch((err) => {
alert('Could not copy text: ' + err);
});
})();