(owner, repo, path, ref string)
| 964 | } |
| 965 | |
| 966 | func buildContentsAPIPath(owner, repo, path, ref string) string { |
| 967 | pathSegments := strings.Split(path, "/") |
| 968 | for i := range pathSegments { |
| 969 | pathSegments[i] = url.PathEscape(pathSegments[i]) |
| 970 | } |
| 971 | return fmt.Sprintf( |
| 972 | "repos/%s/%s/contents/%s?ref=%s", |
| 973 | owner, |
| 974 | repo, |
| 975 | strings.Join(pathSegments, "/"), |
| 976 | url.QueryEscape(ref), |
| 977 | ) |
| 978 | } |
| 979 | |
| 980 | func fetchRemoteFileContent(client *api.RESTClient, owner, repo, path, ref string, fileContent any) error { |
| 981 | return client.Get(buildContentsAPIPath(owner, repo, path, ref), fileContent) |
no outgoing calls