Skip to content

[Code Quality] Extract CreateEntityBaseConfig to eliminate 8-field duplication across safe-output configs #46914

Description

@github-actions

Description

CreateIssuesConfig, CreateDiscussionsConfig, and CreatePullRequestsConfig all share BaseSafeOutputConfig (good) but also copy-paste a second tier of ~8 entity-creation fields with identical yaml tags: TitlePrefix, Labels, AllowedLabels, TargetRepoSlug, AllowedRepos, CloseOlderKey, Expires, and Footer. Any future field addition or tag change must be made in all three files.

Suggested Changes

  1. Define a new CreateEntityBaseConfig struct embedding BaseSafeOutputConfig plus the ~8 shared fields.
  2. Replace the copy-pasted fields in CreateIssuesConfig, CreateDiscussionsConfig, and CreatePullRequestsConfig with CreateEntityBaseConfig embed.
  3. Verify that yaml/json tags are preserved exactly (no serialization changes).
  4. Run existing tests to confirm no regressions.

Files Affected

  • pkg/workflow/create_issue.goCreateIssuesConfig
  • pkg/workflow/create_discussion.goCreateDiscussionsConfig
  • pkg/workflow/create_pull_request.goCreatePullRequestsConfig
  • New location for CreateEntityBaseConfig (likely pkg/workflow/create_base.go or inline in one of the above)

Success Criteria

  • CreateEntityBaseConfig exists as a shared base for the three create-entity configs.
  • All three config structs embed it instead of copy-pasting fields.
  • yaml/json serialization is unchanged.
  • All existing tests pass.
  • Future field additions to shared entity config require a change in only one place.

Source

Extracted from Typist — Go Type Consistency Analysis #46823

Priority

Medium — reduces 8-field duplication across 3 files, ~2–3 hours effort.

🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · 39.8 AIC · ⌖ 5.41 AIC · ⊞ 7K ·

  • expires on Jul 21, 2026, 11:21 AM UTC-08:00

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions