MCPcopy Index your code
hub / github.com/cli/cli / validateSignerWorkflow

Function validateSignerWorkflow

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

Source from the content-addressed store, hash-verified

147}
148
149func 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}

Callers 2

newEnforcementCriteriaFunction · 0.85

Calls

no outgoing calls

Tested by 1