Skip to content

Commit

Permalink
Fix import of issues without body message
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ssinhaleite authored Dec 5, 2023
1 parent ec4f6a8 commit 40c1806
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions import.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 40c1806

Please sign in to comment.