MCPcopy Create free account
hub / github.com/cli/cli / validateSignerWorkflow

Function validateSignerWorkflow

pkg/cmd/attestation/verify/policy.go:185–204  ·  view source on GitHub ↗
(hostname, signerWorkflow string)

Source from the content-addressed store, hash-verified

183}
184
185func 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}

Calls 1

signerWorkflowSANPatternFunction · 0.85