Skip to content

Commit

Permalink
fix: Set success Git commit status in case of skipped checks (#300)
Browse files Browse the repository at this point in the history
* fix: Set `success` Git commit status in case of skipped checks

* do not forget about gitlab
  • Loading branch information
andridzi authored Oct 29, 2024
1 parent 2d7b205 commit 35dfcf6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions pkg/commitState.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func (s CommitState) BareString() string {

var stateString = map[CommitState]string{
StateNone: "",
StateSkip: "Skipped",
StateSuccess: "Passed",
StateRunning: "Running",
StateWarning: "Warning",
Expand Down Expand Up @@ -62,6 +63,8 @@ func ParseCommitState(s string) (CommitState, error) {
return StateError, nil
case "panic":
return StatePanic, nil
case "skip", "skipped":
return StateSkip, nil
default:
return StateNone, fmt.Errorf("unknown commit state: %s", s)

Expand Down
2 changes: 1 addition & 1 deletion pkg/vcs/github_client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func toGithubCommitStatus(state pkg.CommitState) *string {
return pkg.Pointer("failure")
case pkg.StateRunning:
return pkg.Pointer("pending")
case pkg.StateSuccess, pkg.StateWarning, pkg.StateNone:
case pkg.StateSuccess, pkg.StateWarning, pkg.StateNone, pkg.StateSkip:
return pkg.Pointer("success")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/vcs/gitlab_client/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func convertState(state pkg.CommitState) gitlab.BuildStateValue {
return gitlab.Running
case pkg.StateFailure, pkg.StateError, pkg.StatePanic:
return gitlab.Failed
case pkg.StateSuccess, pkg.StateWarning, pkg.StateNone:
case pkg.StateSuccess, pkg.StateWarning, pkg.StateNone, pkg.StateSkip:
return gitlab.Success
}

Expand Down

0 comments on commit 35dfcf6

Please sign in to comment.