(httpClient *http.Client, repo ghrepo.Interface)
| 37 | } |
| 38 | |
| 39 | func hasScript(httpClient *http.Client, repo ghrepo.Interface) (bool, error) { |
| 40 | path := fmt.Sprintf("repos/%s/%s/contents/%s", |
| 41 | repo.RepoOwner(), repo.RepoName(), repo.RepoName()) |
| 42 | url := ghinstance.RESTPrefix(repo.RepoHost()) + path |
| 43 | req, err := http.NewRequest("GET", url, nil) |
| 44 | if err != nil { |
| 45 | return false, err |
| 46 | } |
| 47 | |
| 48 | resp, err := httpClient.Do(req) |
| 49 | if err != nil { |
| 50 | return false, err |
| 51 | } |
| 52 | defer resp.Body.Close() |
| 53 | |
| 54 | if resp.StatusCode == 404 { |
| 55 | return false, nil |
| 56 | } |
| 57 | |
| 58 | if resp.StatusCode > 299 { |
| 59 | err = api.HandleHTTPError(resp) |
| 60 | return false, err |
| 61 | } |
| 62 | |
| 63 | return true, nil |
| 64 | } |
| 65 | |
| 66 | type releaseAsset struct { |
| 67 | Name string |
no test coverage detected