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