| 331 | } |
| 332 | |
| 333 | func (d *detector) RepositoryFeatures() (RepositoryFeatures, error) { |
| 334 | if !ghauth.IsEnterprise(d.host) { |
| 335 | return allRepositoryFeatures, nil |
| 336 | } |
| 337 | |
| 338 | features := RepositoryFeatures{} |
| 339 | |
| 340 | var featureDetection struct { |
| 341 | Repository struct { |
| 342 | Fields []struct { |
| 343 | Name string |
| 344 | } `graphql:"fields(includeDeprecated: true)"` |
| 345 | } `graphql:"Repository: __type(name: \"Repository\")"` |
| 346 | } |
| 347 | |
| 348 | gql := api.NewClientFromHTTP(d.client()) |
| 349 | |
| 350 | err := gql.Query(d.host, "Repository_fields", &featureDetection, nil) |
| 351 | if err != nil { |
| 352 | return features, err |
| 353 | } |
| 354 | |
| 355 | for _, field := range featureDetection.Repository.Fields { |
| 356 | if field.Name == "pullRequestTemplates" { |
| 357 | features.PullRequestTemplateQuery = true |
| 358 | } |
| 359 | if field.Name == "visibility" { |
| 360 | features.VisibilityField = true |
| 361 | } |
| 362 | if field.Name == "autoMergeAllowed" { |
| 363 | features.AutoMerge = true |
| 364 | } |
| 365 | } |
| 366 | |
| 367 | return features, nil |
| 368 | } |
| 369 | |
| 370 | const ( |
| 371 | enterpriseProjectsV1Removed = "3.17.0" |