File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -538,12 +538,7 @@ func (fc *FrontmatterConfig) ToMap() map[string]any {
538538 result ["version" ] = fc .Version
539539 }
540540 if fc .TimeoutMinutes != nil {
541- // Return as integer for numeric literals, string for expressions
542- if fc .TimeoutMinutes .IsExpression () {
543- result ["timeout-minutes" ] = fc .TimeoutMinutes .String ()
544- } else {
545- result ["timeout-minutes" ] = fc .TimeoutMinutes .IntValue ()
546- }
541+ result ["timeout-minutes" ] = fc .TimeoutMinutes .ToValue ()
547542 }
548543 if fc .Strict != nil {
549544 result ["strict" ] = * fc .Strict
Original file line number Diff line number Diff line change @@ -112,6 +112,22 @@ func (t *TemplatableInt32) IntValue() int {
112112 return 0 // expression strings are not evaluable at compile time
113113}
114114
115+ // ToValue returns the native Go value for use in map literals and JSON output:
116+ // - an int for numeric literals (e.g. 30)
117+ // - a string for GitHub Actions expressions (e.g. "${{ inputs.timeout }}")
118+ //
119+ // This is the canonical helper for producing a map[string]any entry;
120+ // callers should prefer it over calling IsExpression + IntValue/String manually.
121+ func (t * TemplatableInt32 ) ToValue () any {
122+ if t .IsExpression () {
123+ return string (* t )
124+ }
125+ if n , err := strconv .Atoi (string (* t )); err == nil {
126+ return n
127+ }
128+ return string (* t )
129+ }
130+
115131// Ptr returns a pointer to a copy of t, convenient for constructing
116132// *TemplatableInt32 values inline.
117133func (t * TemplatableInt32 ) Ptr () * TemplatableInt32 {
You can’t perform that action at this time.
0 commit comments