Feat v0.3.4 team roles signoff (#18)
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com> Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #18.
This commit is contained in:
@@ -24,8 +24,28 @@ type Condition struct {
|
||||
|
||||
// StageConfig holds non-routing config from stage_config JSON.
|
||||
type StageConfig struct {
|
||||
AutoAssign string `json:"auto_assign,omitempty"`
|
||||
OnAdvance *OnAdvanceReference `json:"on_advance,omitempty"`
|
||||
AutoAssign string `json:"auto_assign,omitempty"`
|
||||
RequiredRole string `json:"required_role,omitempty"`
|
||||
Validation *ValidationConfig `json:"validation,omitempty"`
|
||||
OnAdvance *OnAdvanceReference `json:"on_advance,omitempty"`
|
||||
}
|
||||
|
||||
// ValidationConfig defines multi-party sign-off requirements for a stage.
|
||||
type ValidationConfig struct {
|
||||
RequiredApprovals int `json:"required_approvals"` // e.g. 2
|
||||
RequiredRole string `json:"required_role,omitempty"` // role needed to sign off
|
||||
RejectAction string `json:"reject_action,omitempty"` // "cancel" | stage name
|
||||
}
|
||||
|
||||
// ParseStageConfig unmarshals a stage_config JSON blob into StageConfig.
|
||||
// Returns zero-value StageConfig on empty/invalid input.
|
||||
func ParseStageConfig(raw json.RawMessage) StageConfig {
|
||||
var sc StageConfig
|
||||
if len(raw) == 0 || string(raw) == "{}" || string(raw) == "null" {
|
||||
return sc
|
||||
}
|
||||
_ = json.Unmarshal(raw, &sc)
|
||||
return sc
|
||||
}
|
||||
|
||||
// OnAdvanceReference points to a Starlark hook for on_advance processing.
|
||||
|
||||
Reference in New Issue
Block a user