mirror of
https://gitee.com/gokins/gokins.git
synced 2024-11-29 17:57:50 +08:00
commit
83ff22f96c
@ -86,6 +86,38 @@ function main(){
|
||||
ret.check=true;
|
||||
return ret
|
||||
}
|
||||
`,
|
||||
}
|
||||
// 添加对阿里云的codeup的支持!
|
||||
HookjsMap["codeup"] = &Hookjs{
|
||||
Uis: map[string]string{"token": "string", "branch": "string"},
|
||||
Desc: "secret:秘钥,branch:push对象分支",
|
||||
Defs: `{"token":"pwd","branch":"master"}`,
|
||||
js: `
|
||||
|
||||
function main(){
|
||||
console.log('start run main function!!!!');
|
||||
var ret={check:false};
|
||||
var conf=getConf();
|
||||
var body=getBody();
|
||||
var secret=getHeader('X-Codeup-Token');
|
||||
var event=getHeader('X-Codeup-Event');
|
||||
if(conf.secret!=body.secret){
|
||||
ret.errs='触发请求秘钥错误';
|
||||
return ret;
|
||||
}
|
||||
|
||||
if(event!='Push Hook'||!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{
|
||||
|
Loading…
Reference in New Issue
Block a user