MCPcopy Create free account
hub / github.com/github/gh-aw / createView

Function createView

pkg/cli/project_command.go:481–506  ·  view source on GitHub ↗

createView creates a single project view

(ctx context.Context, info projectURLInfo, name, layout string, verbose bool)

Source from the content-addressed store, hash-verified

479
480// createView creates a single project view
481func createView(ctx context.Context, info projectURLInfo, name, layout string, verbose bool) error {
482 projectLog.Printf("Creating view: name=%s, layout=%s", name, layout)
483
484 var path string
485 if info.scope == "orgs" {
486 path = fmt.Sprintf("/orgs/%s/projectsV2/%d/views", info.ownerLogin, info.projectNumber)
487 } else {
488 path = fmt.Sprintf("/users/%s/projectsV2/%d/views", info.ownerLogin, info.projectNumber)
489 }
490
491 _, err := workflow.RunGH(
492 fmt.Sprintf("Creating view %s...", name),
493 "api",
494 "--method", "POST",
495 path,
496 "-H", "Accept: application/vnd.github+json",
497 "-H", "X-GitHub-Api-Version: 2022-11-28",
498 "-f", "name="+name,
499 "-f", "layout="+layout,
500 )
501 if err != nil {
502 return fmt.Errorf("failed to create view: %w", err)
503 }
504
505 return nil
506}
507
508// createStandardFields creates the standard project fields
509func createStandardFields(ctx context.Context, projectURL string, projectNumber int, owner string, verbose bool) error {

Callers 1

createStandardViewsFunction · 0.85

Calls 3

RunGHFunction · 0.92
PrintfMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected