gitee 自动填充commit到pr标题

gitee 自动填充commit到pr标题,多个则拼接

目前為 2023-04-23 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         gitee 自动填充commit到pr标题
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  gitee 自动填充commit到pr标题,多个则拼接
// @author       xxyangyoulin
// @match        https://gitee.com/*/pull/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @license MIT
// ==/UserScript==

function handle(){
    let prt = document.getElementById('pull_request_title')
    if (!prt) return
    Array.prototype.forEach.call(document.getElementsByClassName('markdown-body'),function(item,index,arr){
        if(item.innerText.indexOf("Merge ")===0)return
        if(prt.value)prt.value = prt.value+"; "
        prt.value = prt.value+item.innerText
    });

    //默认删除本分支
    if(document.getElementById("pull_request_source_branch").value!="develop")
        document.getElementsByClassName("prune-checkbox")[0].click();

    Array.prototype.forEach.call(document.getElementsByName('normal_commit'),function(item,index,arr){
        item.removeAttribute('disabled')
        item.classList.remove("disabled")
    });
}
(function() {
    window.onload = function name() {
        setTimeout(() => {
            handle();
            document.getElementById('pull_request_source_branch').onchange = function(){
                console.log(1)
                handle();
            }
        }, 500);
    }
})();