gavinr / github-csv-tools

Import and export GitHub issues via CSV
https://npmjs.com/github-csv-tools
MIT License
657 stars 116 forks source link

If you don't specify the fields, you get all of them and that causes a problem #24

Closed chrismattmann closed 4 years ago

chrismattmann commented 4 years ago

The problem is that if your source repo has a milestone assigned to those fields, they are listed as a URI in them on the export. When you try to import that CSV into your dest repository, it complains and throws a weird Github API error that it doesn't know what that URI is.

A better approach would be to post-process the URIs and/or to create a corresponding milestone in the dest repository if not already there, and then to scrub the CSV data with the new milestone. Or simply to by default exclude any fields that only exist in the source domain unless otherwise specified.

gavinr commented 4 years ago

Thanks for the report! Could you post an example repo that causes the issue? (replication case)

chrismattmann commented 4 years ago

Sure as an example, I used your tool to migrate apache/drat back to its original home of chrismattmann/drat and to copy the issues over. I followed the install guide and created a token, and then just used the exporter which if you don't specify any fields you get all the fields. Then I tried to import that CSV file using the importer and it error'ed out b/c all the fields included milestones that existed in apache/drat but not chrismattmann/drat. By hand editing the CSV to remove the additional milestone related URI fields, then the import worked. Make sense?

gavinr commented 4 years ago

Thanks for the example. I didn't actually consider the "GitHub repo to GitHub repo" copy example - I personally was more interested in exporting or importing to/from GitHub.

Given all of that, I appreciate your workflow and there is a certain logic to the fact that the default export should be able to be imported into a fresh GitHub repo. I would propose we make the following changes:

  1. by default, it will only export the milestone.title (with column title milestone)
  2. add additional flag, --exportAll that will export all possible columns (Similar to what is default right now, but maybe even more in the future)

Would those changes solve your issue?

chrismattmann commented 4 years ago

@gavinr completely agree these changes would solve my issue and I appreciate you considering them.

gavinr commented 4 years ago

Importing milestones requires the milestone ID -- not the milestone name. So for the whole export->import process to work, we'll also need to complete #27.

gavinr commented 4 years ago

This is resolved in v2.0.0. Please see the new default fields, the new --exportAll option, and #27. Thanks!

chrismattmann commented 4 years ago

thank you @gavinr !!!