| 269 | } |
| 270 | |
| 271 | func (d *detector) RepositoryFeatures() (RepositoryFeatures, error) { |
| 272 | if !ghauth.IsEnterprise(d.host) { |
| 273 | return allRepositoryFeatures, nil |
| 274 | } |
| 275 | |
| 276 | features := RepositoryFeatures{} |
| 277 | |
| 278 | var featureDetection struct { |
| 279 | Repository struct { |
| 280 | Fields []struct { |
| 281 | Name string |
| 282 | } `graphql:"fields(includeDeprecated: true)"` |
| 283 | } `graphql:"Repository: __type(name: \"Repository\")"` |
| 284 | } |
| 285 | |
| 286 | gql := api.NewClientFromHTTP(d.httpClient) |
| 287 | |
| 288 | err := gql.Query(d.host, "Repository_fields", &featureDetection, nil) |
| 289 | if err != nil { |
| 290 | return features, err |
| 291 | } |
| 292 | |
| 293 | for _, field := range featureDetection.Repository.Fields { |
| 294 | if field.Name == "pullRequestTemplates" { |
| 295 | features.PullRequestTemplateQuery = true |
| 296 | } |
| 297 | if field.Name == "visibility" { |
| 298 | features.VisibilityField = true |
| 299 | } |
| 300 | if field.Name == "autoMergeAllowed" { |
| 301 | features.AutoMerge = true |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | return features, nil |
| 306 | } |
| 307 | |
| 308 | const ( |
| 309 | enterpriseProjectsV1Removed = "3.17.0" |