SanitizeWorkflowName sanitizes a workflow name for use in artifact names and file paths. It converts the name to lowercase and replaces or removes characters that are invalid in YAML artifact names or filesystem paths. This is a SANITIZE function (character validity pattern). Use this when processi
(name string)
| 120 | // |
| 121 | // See package documentation for guidance on when to use sanitize vs normalize patterns. |
| 122 | func SanitizeWorkflowName(name string) string { |
| 123 | return SanitizeName(name, &SanitizeOptions{ |
| 124 | PreserveSpecialChars: []rune{'.', '_', '-'}, |
| 125 | TrimHyphens: false, |
| 126 | DefaultValue: "", |
| 127 | }) |
| 128 | } |
| 129 | |
| 130 | // ShortenCommand creates a short identifier for bash commands in workflow logs. |
| 131 | // It replaces newlines with spaces and truncates to 20 characters if needed. |