MCPcopy Create free account
hub / github.com/cli/cli / RepositoryFeatures

Method RepositoryFeatures

internal/featuredetection/feature_detection.go:294–329  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

292}
293
294func (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
331const (
332 enterpriseProjectsV1Removed = "3.17.0"

Callers 1

TestRepositoryFeaturesFunction · 0.95

Calls 2

NewClientFromHTTPFunction · 0.92
QueryMethod · 0.65

Tested by 1

TestRepositoryFeaturesFunction · 0.76