Merge pull request #33 from mgr9525/dev

codeup
This commit is contained in:
Linsk Ruis 2021-06-21 19:08:47 +08:00 committed by GitHub
commit 83ff22f96c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 3 deletions

View File

@ -255,6 +255,3 @@ Gokins目前还处于需要不断进步的阶段如果你有兴趣假如我
2. 环境变量PATH优化,加入变量获取

View File

@ -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{