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

Method RepositoryFeatures

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

Source from the content-addressed store, hash-verified

331}
332
333func (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
370const (
371 enterpriseProjectsV1Removed = "3.17.0"

Callers 1

TestRepositoryFeaturesFunction · 0.95

Calls 3

clientMethod · 0.95
NewClientFromHTTPFunction · 0.92
QueryMethod · 0.65

Tested by 1

TestRepositoryFeaturesFunction · 0.76