MCPcopy Index your code
hub / github.com/cli/cli / RepositoryFeatures

Method RepositoryFeatures

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

Source from the content-addressed store, hash-verified

268}
269
270func (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
307const (
308 enterpriseProjectsV1Removed = "3.17.0"

Callers 1

TestRepositoryFeaturesFunction · 0.95

Calls 2

NewClientFromHTTPFunction · 0.92
QueryMethod · 0.65

Tested by 1

TestRepositoryFeaturesFunction · 0.76