This commit is contained in:
Dmitry Khomutov 2017-01-21 00:07:12 +07:00
parent d46ecce159
commit d07e98178e
No known key found for this signature in database
GPG key ID: 7EB36C9576F9ECB9
2 changed files with 21 additions and 16 deletions

View file

@ -202,25 +202,30 @@ class GithubBuild extends RemoteGitBuild
$lineStart = null,
$lineEnd = null
) {
$diffLineNumber = $this->getDiffLineNumber($builder, $file, $lineStart);
$allowCommentCommit = (boolean)Config::getInstance()->get('php-censor.github.comments.commit', false);
$allowCommentPullRequest = (boolean)Config::getInstance()->get('php-censor.github.comments.pull_request', false);
if (!is_null($diffLineNumber)) {
$helper = new Github();
if ($allowCommentCommit || $allowCommentPullRequest) {
$diffLineNumber = $this->getDiffLineNumber($builder, $file, $lineStart);
$repo = $this->getProject()->getReference();
$prNumber = $this->getExtra('pull_request_number');
$commit = $this->getCommitId();
if (!is_null($diffLineNumber)) {
$helper = new Github();
$allowCommentCommit = (boolean)Config::getInstance()->get('php-censor.github.comments.commit', false);
$allowCommentPullRequest = (boolean)Config::getInstance()->get('php-censor.github.comments.pull_request', false);
$repo = $this->getProject()->getReference();
$prNumber = $this->getExtra('pull_request_number');
$commit = $this->getCommitId();
if (!empty($prNumber)) {
if ($allowCommentPullRequest) {
$helper->createPullRequestComment($repo, $prNumber, $commit, $file, $diffLineNumber, $message);
}
} else {
if ($allowCommentCommit) {
$helper->createCommitComment($repo, $commit, $file, $diffLineNumber, $message);
$allowCommentCommit = (boolean)Config::getInstance()->get('php-censor.github.comments.commit', false);
$allowCommentPullRequest = (boolean)Config::getInstance()->get('php-censor.github.comments.pull_request', false);
if (!empty($prNumber)) {
if ($allowCommentPullRequest) {
$helper->createPullRequestComment($repo, $prNumber, $commit, $file, $diffLineNumber, $message);
}
} else {
if ($allowCommentCommit) {
$helper->createCommitComment($repo, $commit, $file, $diffLineNumber, $message);
}
}
}
}

View file

@ -145,7 +145,7 @@ class PhpUnit extends Plugin implements ZeroConfigPluginInterface
protected function runConfigFile($configFile)
{
$options = clone $this->options;
$buildPath = $this->build->getBuildPath() . DIRECTORY_SEPARATOR;
$buildPath = $this->build->getBuildPath();
// Save the results into a json file
$jsonFile = tempnam(RUNTIME_DIR, 'jLog_');