| 183 | } |
| 184 | |
| 185 | func validateSignerWorkflow(hostname, signerWorkflow string) (string, error) { |
| 186 | // we expect a provided workflow argument be in the format [HOST/]/<OWNER>/<REPO>/path/to/workflow.yml |
| 187 | // if the provided workflow does not contain a host, set the host |
| 188 | match, err := regexp.MatchString(hostRegex, signerWorkflow) |
| 189 | if err != nil { |
| 190 | return "", err |
| 191 | } |
| 192 | |
| 193 | if match { |
| 194 | return signerWorkflowSANPattern(fmt.Sprintf("https://%s", signerWorkflow)), nil |
| 195 | } |
| 196 | |
| 197 | // if the provided workflow did not match the expect format |
| 198 | // we move onto creating a signer workflow using the provided host name |
| 199 | if hostname == "" { |
| 200 | return "", errors.New("unknown signer workflow host") |
| 201 | } |
| 202 | |
| 203 | return signerWorkflowSANPattern(fmt.Sprintf("https://%s/%s", hostname, signerWorkflow)), nil |
| 204 | } |