MCPcopy Create free account
hub / github.com/github/gh-aw / buildTemplatableEnvVar

Function buildTemplatableEnvVar

pkg/workflow/templatables.go:249–258  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
249func 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

Callers 2

Calls 1

isExpressionFunction · 0.85

Tested by

no test coverage detected