Skip to content

[task] Extract sanitizeLabelContent to dedicated helper file #3132

@github-actions

Description

@github-actions

Objective

Extract the duplicate sanitizeLabelContent function from create_issue.cjs and add_labels.cjs into a dedicated helper file that can be imported individually.

Context

The sanitizeLabelContent function appears identically in two files (100% duplicate, 14 lines). Following the pattern of "1 javascript helper per file so that they can be imported one by one", this function should be extracted to its own module. Part of issue #3119.

Approach

  1. Create new file: pkg/workflow/js/sanitize_label_content.cjs
  2. Move the sanitizeLabelContent function to this new file
  3. Export the function as a CommonJS module: module.exports = { sanitizeLabelContent };
  4. Update pkg/workflow/js/create_issue.cjs to import: const { sanitizeLabelContent } = require('./sanitize_label_content.cjs');
  5. Update pkg/workflow/js/add_labels.cjs to import: const { sanitizeLabelContent } = require('./sanitize_label_content.cjs');
  6. Remove the duplicate function definitions from both files

Files to Modify

  • Create: pkg/workflow/js/sanitize_label_content.cjs (new helper file)
  • Update: pkg/workflow/js/create_issue.cjs (import and remove duplicate)
  • Update: pkg/workflow/js/add_labels.cjs (import and remove duplicate)

Acceptance Criteria

AI generated by Plan Command for #3119

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions