ToValue returns the native Go value for use in map literals and JSON output: - an int for numeric literals (e.g. 30) - a string for GitHub Actions expressions (e.g. "${{ inputs.timeout }}") This is the canonical helper for producing a map[string]any entry; callers should prefer it over calling IsEx
()
| 120 | // This is the canonical helper for producing a map[string]any entry; |
| 121 | // callers should prefer it over calling IsExpression + IntValue/String manually. |
| 122 | func (t *TemplatableInt32) ToValue() any { |
| 123 | if t.IsExpression() { |
| 124 | return string(*t) |
| 125 | } |
| 126 | if n, err := strconv.Atoi(string(*t)); err == nil { |
| 127 | return n |
| 128 | } |
| 129 | return string(*t) |
| 130 | } |
| 131 | |
| 132 | // Ptr returns a pointer to a copy of t, convenient for constructing |
| 133 | // *TemplatableInt32 values inline. |
no test coverage detected