buildTemplatableEnvVar returns a YAML environment variable entry for a templatable field. If value is a GitHub Actions expression it is embedded unquoted so that GitHub Actions can evaluate it at runtime; otherwise the literal string is quoted. Returns nil if value is nil.
(envVarName string, value *string)
| 247 | // embedded unquoted so that GitHub Actions can evaluate it at runtime; |
| 248 | // otherwise the literal string is quoted. Returns nil if value is nil. |
| 249 | func buildTemplatableEnvVar(envVarName string, value *string) []string { |
| 250 | if value == nil { |
| 251 | return nil |
| 252 | } |
| 253 | v := *value |
| 254 | if isExpression(v) { |
| 255 | return []string{fmt.Sprintf(" %s: %s\n", envVarName, v)} |
| 256 | } |
| 257 | return []string{fmt.Sprintf(" %s: %q\n", envVarName, v)} |
| 258 | } |
| 259 | |
| 260 | // buildTemplatableBoolEnvVar returns a YAML environment variable entry for a |
| 261 | // templatable boolean field. If value is a GitHub Actions expression it is |
no test coverage detected