From 9e295d33ad8dea2f6e49242af6d65a85e23d8e9a Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sun, 22 Feb 2026 04:05:00 +0000
Subject: [PATCH 1/2] Initial plan
From 87fba1cec864cd01c6bbfcacefb9e30b3d56e7a2 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sun, 22 Feb 2026 04:15:47 +0000
Subject: [PATCH 2/2] Refactor: Extract shared missing issue handler logic into
missing_issue_helpers.cjs
- Create missing_issue_helpers.cjs with buildMissingIssueHandler() factory
- Refactor create_missing_data_issue.cjs to use shared helper
- Refactor create_missing_tool_issue.cjs to use shared helper
- Add missing_issue_helpers.test.cjs with 14 tests
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
---
.../setup/js/create_missing_data_issue.cjs | 232 ++------------
.../setup/js/create_missing_tool_issue.cjs | 224 ++------------
actions/setup/js/missing_issue_helpers.cjs | 219 +++++++++++++
.../setup/js/missing_issue_helpers.test.cjs | 287 ++++++++++++++++++
4 files changed, 550 insertions(+), 412 deletions(-)
create mode 100644 actions/setup/js/missing_issue_helpers.cjs
create mode 100644 actions/setup/js/missing_issue_helpers.test.cjs
diff --git a/actions/setup/js/create_missing_data_issue.cjs b/actions/setup/js/create_missing_data_issue.cjs
index d40de3922bd..b04fa7bad63 100644
--- a/actions/setup/js/create_missing_data_issue.cjs
+++ b/actions/setup/js/create_missing_data_issue.cjs
@@ -1,11 +1,7 @@
// @ts-check
///
-const { getErrorMessage } = require("./error_helpers.cjs");
-const { renderTemplate } = require("./messages_core.cjs");
-const { createExpirationLine, generateFooterWithExpiration } = require("./ephemerals.cjs");
-const fs = require("fs");
-const { sanitizeContent } = require("./sanitize_content.cjs");
+const { buildMissingIssueHandler } = require("./missing_issue_helpers.cjs");
/**
* @typedef {import('./types/handler-factory').HandlerFactoryFunction} HandlerFactoryFunction
@@ -19,209 +15,27 @@ const HANDLER_TYPE = "create_missing_data_issue";
* Returns a message handler function that processes individual create_missing_data_issue messages
* @type {HandlerFactoryFunction}
*/
-async function main(config = {}) {
- // Extract configuration
- const titlePrefix = config.title_prefix || "[missing data]";
- const envLabels = config.labels ? (Array.isArray(config.labels) ? config.labels : config.labels.split(",")).map(label => String(label).trim()).filter(label => label) : [];
- const maxCount = config.max || 1; // Default to 1 to create only one issue per workflow run
-
- core.info(`Title prefix: ${titlePrefix}`);
- if (envLabels.length > 0) {
- core.info(`Default labels: ${envLabels.join(", ")}`);
- }
- core.info(`Max count: ${maxCount}`);
-
- // Track how many items we've processed for max limit
- let processedCount = 0;
-
- // Track created/updated issues
- const processedIssues = [];
-
- /**
- * Create or update an issue for missing data
- * @param {string} workflowName - Name of the workflow
- * @param {string} workflowSource - Source path of the workflow
- * @param {string} workflowSourceURL - URL to the workflow source
- * @param {string} runUrl - URL to the workflow run
- * @param {Array