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