Exemplo n.º 1
0
 private function getBuildEnv(Build $build)
 {
     $env = ['BUILD_ID=' . $build->getId(), 'PROJECT_ID=' . $build->getProject()->getId(), 'CHANNEL=' . $build->getChannel(), 'SSH_URL=' . $build->getProject()->getGitUrl(), 'REF=' . $build->getRef(), 'HASH=' . $build->getHash(), 'IS_PULL_REQUEST=' . ($build->isPullRequest() ? 1 : 0), 'SYMFONY_ENV=prod'];
     $user = $build->getProject()->getUsers()->first();
     if ($user->hasProviderAccessToken('github')) {
         /**
          * @todo there must be a way to avoid requiring a valid access token
          *       I think the token is only used to avoid hitting github's
          *       API limit through composer, so maybe there's a way to use a
          *       stage1 specific token instead
          */
         $env[] = 'GITHUB_ACCESS_TOKEN=' . $user->getProviderAccessToken('github');
     }
     return $env;
 }