Skip to content

Instantly share code, notes, and snippets.

@splintor
Created April 30, 2020 12:03
Show Gist options
  • Save splintor/4d6b7500c6e2667c8daa731af92c4ae5 to your computer and use it in GitHub Desktop.
Save splintor/4d6b7500c6e2667c8daa731af92c4ae5 to your computer and use it in GitHub Desktop.
Github - Format pull request message
// ==UserScript==
// @name Github - Format pull request message
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Set default value for new PR description
// @author Shmulik Flint
// @match https://github.com/wix-private/*/compare/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const text = document.getElementById('pull_request_body');
if (!text) {
return;
}
let prefix = "## Motivation";
const repoLink = document.querySelector('[data-pjax="#js-repo-pjax-container"]');
if (repoLink && repoLink.text == 'wixos') {
prefix += ' (consider adding *ping* label)';
}
if (!text.value.startsWith('#')) {
text.value = `${prefix}\n${text.value}`;
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment