Fixing links to files on Github when viewing a pull request build.
Fixes #423
This commit is contained in:
parent
c5bd0e0bb8
commit
c3f73cc621
|
@ -109,8 +109,19 @@ class GithubBuild extends RemoteGitBuild
|
||||||
|
|
||||||
public function getFileLinkTemplate()
|
public function getFileLinkTemplate()
|
||||||
{
|
{
|
||||||
$link = 'https://github.com/' . $this->getProject()->getReference() . '/';
|
$reference = $this->getProject()->getReference();
|
||||||
$link .= 'blob/' . $this->getBranch() . '/';
|
$branch = $this->getBranch();
|
||||||
|
|
||||||
|
if ($this->getExtra('build_type') == 'pull_request') {
|
||||||
|
$matches = array();
|
||||||
|
preg_match('/\/([a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+)/', $this->getExtra('remote_url'), $matches);
|
||||||
|
|
||||||
|
$reference = $matches[1];
|
||||||
|
$branch = $this->getExtra('remote_branch');
|
||||||
|
}
|
||||||
|
|
||||||
|
$link = 'https://github.com/' . $reference . '/';
|
||||||
|
$link .= 'blob/' . $branch . '/';
|
||||||
$link .= '{FILE}';
|
$link .= '{FILE}';
|
||||||
$link .= '#L{LINE}';
|
$link .= '#L{LINE}';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue