From 5a2a1f8fdfe990de67410c628492d8e7ec97c64d Mon Sep 17 00:00:00 2001 From: Isaac Sanders Date: Thu, 11 Aug 2022 10:16:26 -0500 Subject: [PATCH 1/2] fix: Uses auto_merge param --- resources.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/resources.go b/resources.go index cc1ddd3..879b4f0 100644 --- a/resources.go +++ b/resources.go @@ -105,6 +105,10 @@ func (p *OutParams) UnmarshalJSON(b []byte) (err error) { p.Description = github.String(getStringOrStringFromFile(p.RawDescription)) } + if p.RawAutoMerge != nil { + p.AutoMerge = github.Bool(getBool(p.RawAutoMerge)) + } + var payload map[string]interface{} json.Unmarshal(p.RawPayload, &payload) @@ -140,6 +144,19 @@ func NewOutRequest() OutRequest { return OutRequest{} } +func getBool(field json.RawMessage) bool { + var rawValue interface{} + if err := json.Unmarshal(field, &rawValue); err == nil { + switch rawValue := rawValue.(type) { + case bool: + return rawValue + default: + panic("Could not read bool out of Params field") + } + } + return "" +} + func getStringOrStringFromFile(field json.RawMessage) string { var rawValue interface{} if err := json.Unmarshal(field, &rawValue); err == nil { From 7e6fc8a8b0bd4d6b8ccd894ab3a744edb434ddec Mon Sep 17 00:00:00 2001 From: Isaac Sanders Date: Thu, 11 Aug 2022 10:19:20 -0500 Subject: [PATCH 2/2] fix: Adds unreachable return for type consistency --- resources.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources.go b/resources.go index 879b4f0..763ac76 100644 --- a/resources.go +++ b/resources.go @@ -154,7 +154,7 @@ func getBool(field json.RawMessage) bool { panic("Could not read bool out of Params field") } } - return "" + return true } func getStringOrStringFromFile(field json.RawMessage) string {