Skip to content

Commit

Permalink
Update server/events/vcs/gitlab_client.go
Browse files Browse the repository at this point in the history
chore: simplify ignored statuses logic

Co-authored-by: Emil 'Skeen' Madsen <[email protected]>
  • Loading branch information
michelmzs and Skeen committed May 13, 2022
1 parent 2cc24a8 commit 7d61513
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions server/events/vcs/gitlab_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,11 @@ func (g *GitlabClient) PullIsMergeable(repo models.Repo, pull models.PullRequest
}

for _, status := range statuses {
if !strings.HasPrefix(status.Name, fmt.Sprintf("atlantis/%s", command.Apply.String())) {
if !status.AllowFailure && project.OnlyAllowMergeIfPipelineSucceeds && status.Status != "success" {
return false, nil
}
if strings.HasPrefix(status.Name, fmt.Sprintf("atlantis/%s", command.Apply.String())) {
continue
}
if !status.AllowFailure && project.OnlyAllowMergeIfPipelineSucceeds && status.Status != "success" {
return false, nil
}
}

Expand Down

0 comments on commit 7d61513

Please sign in to comment.