添加对阿里云的codeup插件的支持

This commit is contained in:
angular 2021-06-18 18:55:10 +08:00
parent b8650ef00f
commit 6fb0358258

View File

@ -86,6 +86,37 @@ function main(){
ret.check=true; ret.check=true;
return ret return ret
} }
`,
}
// 添加对阿里云的codeup的支持
HookjsMap["codeup"] = &Hookjs{
Uis: map[string]string{"token": "string", "branch": "string"},
Desc: "secret:秘钥,branch:push对象分支",
Defs: `{"secret":"pwd","branch":"master"}`,
js: `
function main(){
console.log('start run main function!!!!');
var ret={check:false};
var conf=getConf();
var body=getBody();
var event=getHeader('X-Codeup-Token ');
if(conf.secret!=body.secret){
ret.errs='触发请求秘钥错误';
return ret;
}
if(event!='push'||!body.ref||body.ref==''){
return ret;
}
console.log(conf.branch,body.ref);
if(conf.branch&&conf.branch!=''&&body.ref!='refs/heads/'+conf.branch){
return ret;
}
ret.check=true;
return ret
}
`, `,
} }
HookjsMap["github"] = &Hookjs{ HookjsMap["github"] = &Hookjs{