From 40c180620a243f9ca5105c8cba2c69630cc8735e Mon Sep 17 00:00:00 2001 From: Vanessa Leite Date: Tue, 5 Dec 2023 14:49:42 +0100 Subject: [PATCH 1/2] Fix import of issues without body message The CSV import threw an error when an issue didn't have a body defined. Since it is a good practice to have a body defined, in the case of importing issues, we duplicate the title into the body. While this doesn't clarify the issue, it highlights the problem and still imports the issue. --- import.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/import.js b/import.js index b0c12b2..6de8dc2 100644 --- a/import.js +++ b/import.js @@ -41,8 +41,14 @@ const importFile = (octokit, file, values) => { sendObj.issue.title = row[titleIndex]; // if we have a body column, pass that. - if (bodyIndex > -1 && row[bodyIndex] !== "") { - sendObj.issue.body = row[bodyIndex]; + if (bodyIndex > -1) { + if (row[bodyIndex] !== "") { + sendObj.issue.body = row[bodyIndex]; + } + else { + // if the body is not defined, copy the title to the body of the issue + sendObj.issue.body = row[titleIndex]; + } } // if we have a labels column, pass that. From ad03aae071bacd46c770cb1f87a4ae57ff0541ef Mon Sep 17 00:00:00 2001 From: Vanessa Leite Date: Tue, 5 Dec 2023 15:02:12 +0100 Subject: [PATCH 2/2] Add an example of valid CSV file where at least one of body lines is empty --- test/emptyBodyLines.csv | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 test/emptyBodyLines.csv diff --git a/test/emptyBodyLines.csv b/test/emptyBodyLines.csv new file mode 100644 index 0000000..b480fdf --- /dev/null +++ b/test/emptyBodyLines.csv @@ -0,0 +1,3 @@ +title, body,labels +Test 1, , bug +Test 2, This is the test2 desc, question