ParseMetadataRepo extracts repository information from skill metadata.
(meta map[string]interface{})
| 33 | |
| 34 | // ParseMetadataRepo extracts repository information from skill metadata. |
| 35 | func ParseMetadataRepo(meta map[string]interface{}) (ghrepo.Interface, bool, error) { |
| 36 | if meta == nil { |
| 37 | return nil, false, nil |
| 38 | } |
| 39 | |
| 40 | repoValue, _ := meta["github-repo"].(string) |
| 41 | if repoValue == "" { |
| 42 | return nil, false, nil |
| 43 | } |
| 44 | |
| 45 | repo, err := ParseRepoURL(repoValue) |
| 46 | if err != nil { |
| 47 | return nil, true, err |
| 48 | } |
| 49 | |
| 50 | return repo, true, nil |
| 51 | } |
| 52 | |
| 53 | // ValidateSupportedHost rejects hosts that are not supported. |
| 54 | // Supported hosts are github.com and GHEC with data residency (*.ghe.com). |