createStandardFields creates the standard project fields
(ctx context.Context, projectURL string, projectNumber int, owner string, verbose bool)
| 507 | |
| 508 | // createStandardFields creates the standard project fields |
| 509 | func createStandardFields(ctx context.Context, projectURL string, projectNumber int, owner string, verbose bool) error { |
| 510 | projectLog.Print("Creating standard fields") |
| 511 | console.LogVerbose(verbose, "Creating custom fields...") |
| 512 | |
| 513 | // Define required fields |
| 514 | // Note: We use "Target Repo" instead of "Repository" because GitHub has a built-in |
| 515 | // REPOSITORY field type that conflicts with custom field creation |
| 516 | fields := []struct { |
| 517 | name string |
| 518 | dataType string |
| 519 | options []string // For SINGLE_SELECT fields |
| 520 | }{ |
| 521 | {"Tracker Id", "TEXT", nil}, |
| 522 | {"Worker Workflow", "TEXT", nil}, |
| 523 | {"Target Repo", "TEXT", nil}, |
| 524 | {"Priority", "SINGLE_SELECT", []string{"High", "Medium", "Low"}}, |
| 525 | {"Size", "SINGLE_SELECT", []string{"Small", "Medium", "Large"}}, |
| 526 | {"Start Date", "DATE", nil}, |
| 527 | {"End Date", "DATE", nil}, |
| 528 | } |
| 529 | |
| 530 | // Create each field |
| 531 | for _, field := range fields { |
| 532 | if err := createField(ctx, projectNumber, owner, field.name, field.dataType, field.options, verbose); err != nil { |
| 533 | return fmt.Errorf("failed to create field '%s': %w", field.name, err) |
| 534 | } |
| 535 | console.LogVerbose(verbose, "Created field: "+field.name) |
| 536 | } |
| 537 | |
| 538 | return nil |
| 539 | } |
| 540 | |
| 541 | // createField creates a single field in the project |
| 542 | func createField(ctx context.Context, projectNumber int, owner, name, dataType string, options []string, verbose bool) error { |
no test coverage detected