(hostname, signerWorkflow string)
| 147 | } |
| 148 | |
| 149 | func validateSignerWorkflow(hostname, signerWorkflow string) (string, error) { |
| 150 | // we expect a provided workflow argument be in the format [HOST/]/<OWNER>/<REPO>/path/to/workflow.yml |
| 151 | // if the provided workflow does not contain a host, set the host |
| 152 | match, err := regexp.MatchString(hostRegex, signerWorkflow) |
| 153 | if err != nil { |
| 154 | return "", err |
| 155 | } |
| 156 | |
| 157 | if match { |
| 158 | return fmt.Sprintf("^https://%s", signerWorkflow), nil |
| 159 | } |
| 160 | |
| 161 | // if the provided workflow did not match the expect format |
| 162 | // we move onto creating a signer workflow using the provided host name |
| 163 | if hostname == "" { |
| 164 | return "", errors.New("unknown signer workflow host") |
| 165 | } |
| 166 | |
| 167 | return fmt.Sprintf("^https://%s/%s", hostname, signerWorkflow), nil |
| 168 | } |
no outgoing calls