Skip to content

[task] Organize scattered helper functions into dedicated helper files #3538

@github-actions

Description

@github-actions

Objective

Create dedicated helper files and move generic helper functions from various files to improve code organization and reduce duplication.

Context

Generic helper functions are distributed across multiple files without clear organizational pattern. Examples include configuration parsing helpers in config.go and generic utilities in frontmatter_extraction.go.

Part of issue #3435.

Approach

1. Create helper files

  • pkg/workflow/config_helpers.go - Configuration parsing helpers
  • pkg/workflow/frontmatter_helpers.go - Frontmatter extraction utilities

2. Move configuration parsing helpers from config.go

Move these functions to config_helpers.go:

  • parseLabelsFromConfig(configMap map[string]any) []string
  • parseTitlePrefixFromConfig(configMap map[string]any) string
  • parseTargetRepoFromConfig(configMap map[string]any) string
  • Any other similar config parsing helper functions

3. Move frontmatter utilities from frontmatter_extraction.go

Move these functions to frontmatter_helpers.go:

  • extractStringValue(frontmatter map[string]any, key string) string
  • parseIntValue(value any) (int, bool)
  • filterMapKeys(m map[string]any, keysToKeep []string) map[string]any
  • Any other similar generic utility functions

4. Update imports and references

  • Update all files that call these helper functions
  • Ensure no circular dependencies
  • Verify helper functions are exported (capitalized) if needed across packages

Files to Modify

Create:

  • pkg/workflow/config_helpers.go
  • pkg/workflow/frontmatter_helpers.go

Update:

  • pkg/workflow/config.go (remove moved functions)
  • pkg/workflow/frontmatter_extraction.go (remove moved functions)
  • Any files that import these helper functions
  • Update test files as needed

Acceptance Criteria

AI generated by Plan Command for #3435

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions