createView creates a single project view
(ctx context.Context, info projectURLInfo, name, layout string, verbose bool)
| 479 | |
| 480 | // createView creates a single project view |
| 481 | func 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 |
| 509 | func createStandardFields(ctx context.Context, projectURL string, projectNumber int, owner string, verbose bool) error { |
no test coverage detected