avoid using log.Fatal (#1759)
This commit is contained in:
parent
2ea7891787
commit
baf3bcf48b
1 changed files with 14 additions and 21 deletions
|
@ -58,9 +58,8 @@ func (w *Workflow) On() []string {
|
||||||
func (w *Workflow) OnEvent(event string) interface{} {
|
func (w *Workflow) OnEvent(event string) interface{} {
|
||||||
if w.RawOn.Kind == yaml.MappingNode {
|
if w.RawOn.Kind == yaml.MappingNode {
|
||||||
var val map[string]interface{}
|
var val map[string]interface{}
|
||||||
err := w.RawOn.Decode(&val)
|
if !decodeNode(w.RawOn, &val) {
|
||||||
if err != nil {
|
return nil
|
||||||
log.Fatal(err)
|
|
||||||
}
|
}
|
||||||
return val[event]
|
return val[event]
|
||||||
}
|
}
|
||||||
|
@ -85,16 +84,14 @@ func (w *Workflow) WorkflowDispatchConfig() *WorkflowDispatch {
|
||||||
}
|
}
|
||||||
|
|
||||||
var val map[string]yaml.Node
|
var val map[string]yaml.Node
|
||||||
err := w.RawOn.Decode(&val)
|
if !decodeNode(w.RawOn, &val) {
|
||||||
if err != nil {
|
return nil
|
||||||
log.Fatal(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var config WorkflowDispatch
|
var config WorkflowDispatch
|
||||||
node := val["workflow_dispatch"]
|
node := val["workflow_dispatch"]
|
||||||
err = node.Decode(&config)
|
if !decodeNode(node, &config) {
|
||||||
if err != nil {
|
return nil
|
||||||
log.Fatal(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return &config
|
return &config
|
||||||
|
@ -128,16 +125,14 @@ func (w *Workflow) WorkflowCallConfig() *WorkflowCall {
|
||||||
}
|
}
|
||||||
|
|
||||||
var val map[string]yaml.Node
|
var val map[string]yaml.Node
|
||||||
err := w.RawOn.Decode(&val)
|
if !decodeNode(w.RawOn, &val) {
|
||||||
if err != nil {
|
return &WorkflowCall{}
|
||||||
log.Fatal(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var config WorkflowCall
|
var config WorkflowCall
|
||||||
node := val["workflow_call"]
|
node := val["workflow_call"]
|
||||||
err = node.Decode(&config)
|
if !decodeNode(node, &config) {
|
||||||
if err != nil {
|
return &WorkflowCall{}
|
||||||
log.Fatal(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return &config
|
return &config
|
||||||
|
@ -220,9 +215,8 @@ func (j *Job) InheritSecrets() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
var val string
|
var val string
|
||||||
err := j.RawSecrets.Decode(&val)
|
if !decodeNode(j.RawSecrets, &val) {
|
||||||
if err != nil {
|
return false
|
||||||
log.Fatal(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return val == "inherit"
|
return val == "inherit"
|
||||||
|
@ -234,9 +228,8 @@ func (j *Job) Secrets() map[string]string {
|
||||||
}
|
}
|
||||||
|
|
||||||
var val map[string]string
|
var val map[string]string
|
||||||
err := j.RawSecrets.Decode(&val)
|
if !decodeNode(j.RawSecrets, &val) {
|
||||||
if err != nil {
|
return nil
|
||||||
log.Fatal(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return val
|
return val
|
||||||
|
|
Loading…
Reference in a new issue