Refactored push and tag webhooks for Github (Fixes).
This commit is contained in:
parent
6e60c07103
commit
0e83599b9f
|
@ -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);
|
||||
$builds = $this->buildStore->getByProjectAndCommit($project->getId(), $commitId, $branch);
|
||||
|
||||
$ignore_environments = [];
|
||||
if ($builds['count']) {
|
||||
|
|
|
@ -177,16 +177,21 @@ class BuildStore extends Store
|
|||
|
||||
/**
|
||||
* Return an array of builds for a given project and commit ID.
|
||||
* @param $projectId
|
||||
* @param $commitId
|
||||
*
|
||||
* @param integer $projectId
|
||||
* @param string $commitId
|
||||
* @param string $branch
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getByProjectAndCommit($projectId, $commitId)
|
||||
public function getByProjectAndCommit($projectId, $commitId, $branch)
|
||||
{
|
||||
$query = 'SELECT * FROM {{build}} WHERE {{project_id}} = :project_id AND {{commit_id}} = :commit_id';
|
||||
$stmt = Database::getConnection('read')->prepareCommon($query);
|
||||
$query = 'SELECT * FROM {{build}} WHERE {{project_id}} = :project_id AND {{commit_id}} = :commit_id AND {{branch}} = :branch';
|
||||
$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