Refactored push and tag webhooks for Github (Fixes +++).
This commit is contained in:
parent
0e83599b9f
commit
f26f000bb4
|
@ -246,7 +246,7 @@ class WebhookController extends Controller
|
|||
} else {
|
||||
try {
|
||||
if ($isTag) {
|
||||
$branch = str_replace('refs/tags/', 'Tag: ', $payload['ref']);
|
||||
$branch = str_replace('refs/heads/', '', $payload['base_ref']);
|
||||
$committer = $payload['pusher']['email'];
|
||||
} else {
|
||||
$branch = str_replace('refs/heads/', '', $payload['ref']);
|
||||
|
@ -513,7 +513,7 @@ class WebhookController extends Controller
|
|||
}
|
||||
|
||||
// Check if a build already exists for this commit ID:
|
||||
$builds = $this->buildStore->getByProjectAndCommit($project->getId(), $commitId, $branch);
|
||||
$builds = $this->buildStore->getByProjectAndCommit($project->getId(), $commitId);
|
||||
|
||||
$ignore_environments = [];
|
||||
if ($builds['count']) {
|
||||
|
|
|
@ -180,18 +180,16 @@ class BuildStore extends Store
|
|||
*
|
||||
* @param integer $projectId
|
||||
* @param string $commitId
|
||||
* @param string $branch
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getByProjectAndCommit($projectId, $commitId, $branch)
|
||||
public function getByProjectAndCommit($projectId, $commitId)
|
||||
{
|
||||
$query = 'SELECT * FROM {{build}} WHERE {{project_id}} = :project_id AND {{commit_id}} = :commit_id AND {{branch}} = :branch';
|
||||
$query = 'SELECT * FROM {{build}} WHERE {{project_id}} = :project_id AND {{commit_id}} = :commit_id';
|
||||
$stmt = Database::getConnection('read')->prepareCommon($query);
|
||||
|
||||
$stmt->bindValue(':project_id', $projectId);
|
||||
$stmt->bindValue(':commit_id', $commitId);
|
||||
$stmt->bindValue(':branch', $branch);
|
||||
|
||||
if ($stmt->execute()) {
|
||||
$res = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
|
|
Loading…
Reference in a new issue