Skip to content

Commit

Permalink
fix: adding of duplicate commit statuses in gitlab
Browse files Browse the repository at this point in the history
RESOLVES #1009
  • Loading branch information
Moritz Rieger committed Dec 19, 2024
1 parent 8b1d9a1 commit 7310c11
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/notifier/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ func (g *GitLab) Post(ctx context.Context, event eventv1.Event) error {
Description: desc,
}

getOpt := &gitlab.GetCommitStatusesOptions{}
getOpt := &gitlab.GetCommitStatusesOptions{
Name: &status.Name,
}
statuses, _, err := g.Client.Commits.GetCommitStatuses(g.Id, rev, getOpt, gitlab.WithContext(ctx))
if err != nil {
return fmt.Errorf("unable to list commit status: %s", err)
Expand Down Expand Up @@ -134,10 +136,8 @@ func toGitLabState(severity string) (gitlab.BuildStateValue, error) {

func duplicateGitlabStatus(statuses []*gitlab.CommitStatus, status *gitlab.CommitStatus) bool {
for _, s := range statuses {
if s.SHA == status.SHA {
if s.Status == status.Status && s.Description == status.Description && s.Name == status.Name {
return true
}
if s.Status == status.Status && s.Description == status.Description && s.Name == status.Name {
return true
}
}

Expand Down

0 comments on commit 7310c11

Please # to comment.