We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4ce83a2 commit 6c44502Copy full SHA for 6c44502
scm/const.go
@@ -6,6 +6,7 @@ package scm
6
7
import (
8
"encoding/json"
9
+ "strings"
10
)
11
12
// State represents the commit state.
@@ -47,6 +48,28 @@ func (s State) String() string {
47
48
}
49
50
51
+// ToState converts the given text to a state
52
+func ToState(s string) State {
53
+ switch strings.ToLower(s) {
54
+ case "pending":
55
+ return StatePending
56
+ case "running":
57
+ return StateRunning
58
+ case "success":
59
+ return StateSuccess
60
+ case "failure":
61
+ return StateFailure
62
+ case "cancelled":
63
+ return StateCanceled
64
+ case "expected":
65
+ return StateExpected
66
+ case "error":
67
+ return StateError
68
+ default:
69
+ return StateUnknown
70
+ }
71
+}
72
+
73
// Action identifies webhook actions.
74
type Action int
75
0 commit comments