Skip to content

Commit a212efb

Browse files
committed
Fix hook bug
1 parent 8feaa59 commit a212efb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

hook.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
if ($config['env']==='dev'){
1717
// process push event
1818
if($payload->ref === 'refs/heads/master'){
19-
$repoConf = findRepoConf($payload->repository->name);
19+
$repoConf = findRepoConf($config['repos'], $payload->repository->name);
2020
if(!$repoConf){
2121
exit(0);
2222
}
@@ -27,7 +27,7 @@
2727
} else {
2828
// process release event
2929
if($payload->action=='published'){
30-
$repoConf = findRepoConf($payload->repository->name);
30+
$repoConf = findRepoConf($config['repos'], $payload->repository->name);
3131
if(in_array($payload->release->author->login, $repoConf['allowed_users'])){
3232
$output = shell_exec('./pull.sh '.$repoConf['path']);
3333
file_put_contents('github_pull.log', print_r($output, TRUE), FILE_APPEND);
@@ -42,8 +42,8 @@
4242
file_put_contents('github.log', print_r($output, TRUE), FILE_APPEND);
4343
}*/
4444

45-
function findRepoConf($repoName){
46-
foreach($config['repos'] as $repo){
45+
function findRepoConf($repos, $repoName){
46+
foreach($repos as $repo){
4747
if($repo['name']===$repoName){
4848
return $repo;
4949
}

0 commit comments

Comments
 (0)