diff --git a/.github/helpers/github-api/create-and-close-existing-issue.mjs b/.github/helpers/github-api/create-and-close-existing-issue.mjs index e520b911a..a2d732831 100644 --- a/.github/helpers/github-api/create-and-close-existing-issue.mjs +++ b/.github/helpers/github-api/create-and-close-existing-issue.mjs @@ -9,9 +9,6 @@ export const createAndCloseExistingIssue = async (issueTitle, issueBody, issueCo // Check for existing Issue. const existingIssueNumber = await findIssueByTitle(issueTitle); - console.log(typeof issueComment); - console.log(issueComment); - if (existingIssueNumber && !Number.isNaN(Number(existingIssueNumber))) { // Close old Issue. await closeIssue(Number(existingIssueNumber)); @@ -20,12 +17,13 @@ export const createAndCloseExistingIssue = async (issueTitle, issueBody, issueCo // Create new Issue. await createIssue(issueTitle, decodeURIComponent(issueBody)); - setTimeout(() => console.log("pausing for issue to be created..."), 2000); + setTimeout(() => console.log("pausing for issue to be created..."), 1500); + // get the issue number for the issue just created const newIssueNumber = await findIssueByTitle(issueTitle); // Add comment to Issue. - await addComment(newIssueNumber, issueComment); + await addComment(newIssueNumber, JSON.stringify(issueComment)); }; export default createAndCloseExistingIssue; diff --git a/.github/helpers/npm-deps/create-report-issues.cjs b/.github/helpers/npm-deps/create-report-issues.cjs index 778a807c6..5c7afbe7d 100644 --- a/.github/helpers/npm-deps/create-report-issues.cjs +++ b/.github/helpers/npm-deps/create-report-issues.cjs @@ -8,13 +8,16 @@ const outputText = require(path.resolve(__dirname, `../../../outputText.json`)); // Get package.json paths and comment contents from env. const packageJsonPaths = JSON.parse(process.env.packageJsonPaths); -const comment = process.env.commentContents; +const commentIn = JSON.parse(process.env.commentContents); (async () => { const module = await import('../github-api/create-and-close-existing-issue.mjs'); const createAndCloseExistingIssue = module.default; // Create an array of promises for each packageJsonPath. const promises = packageJsonPaths.map(async (packagePath) => { + // get the comment for this folder + const comment = commentIn[packagePath]; + // create title const issueTitle = packagePath !== '.' ? `${packagePath} NPM Dependency Report` : 'NPM Dependency Report'; // Await the completion of create and close existing issue. diff --git a/.github/helpers/npm-deps/parse_to_comment.py b/.github/helpers/npm-deps/parse_to_comment.py index 669106a29..6c4ddcf0b 100644 --- a/.github/helpers/npm-deps/parse_to_comment.py +++ b/.github/helpers/npm-deps/parse_to_comment.py @@ -15,15 +15,14 @@ } Sample Output: -{ "folder1": { "count": , - "patch": { "count": , +{ "folder1": { "patch": { "count": , "updateCmd": , "detailedList":[ "Update from to ", ... , "Update from to " ] }, "minor": { ... }, - "major": { ... } }, + "major": { ... } ], ... , "folderN": { ... } } @@ -280,7 +279,7 @@ def create_update_dict(folder, outdated_json): return WARNING # define return dictionary and set count - return_dict = {"count": len(patch_li) + len(minor_li) + len(major_li)} + return_dict = {} if S_PATCH in LEVELS and len(patch_li) > 0: # if we are reporting on patch and there are updates include that section