| 292 | } |
| 293 | |
| 294 | func (d *detector) RepositoryFeatures() (RepositoryFeatures, error) { |
| 295 | if !ghauth.IsEnterprise(d.host) { |
| 296 | return allRepositoryFeatures, nil |
| 297 | } |
| 298 | |
| 299 | features := RepositoryFeatures{} |
| 300 | |
| 301 | var featureDetection struct { |
| 302 | Repository struct { |
| 303 | Fields []struct { |
| 304 | Name string |
| 305 | } `graphql:"fields(includeDeprecated: true)"` |
| 306 | } `graphql:"Repository: __type(name: \"Repository\")"` |
| 307 | } |
| 308 | |
| 309 | gql := api.NewClientFromHTTP(d.httpClient) |
| 310 | |
| 311 | err := gql.Query(d.host, "Repository_fields", &featureDetection, nil) |
| 312 | if err != nil { |
| 313 | return features, err |
| 314 | } |
| 315 | |
| 316 | for _, field := range featureDetection.Repository.Fields { |
| 317 | if field.Name == "pullRequestTemplates" { |
| 318 | features.PullRequestTemplateQuery = true |
| 319 | } |
| 320 | if field.Name == "visibility" { |
| 321 | features.VisibilityField = true |
| 322 | } |
| 323 | if field.Name == "autoMergeAllowed" { |
| 324 | features.AutoMerge = true |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | return features, nil |
| 329 | } |
| 330 | |
| 331 | const ( |
| 332 | enterpriseProjectsV1Removed = "3.17.0" |