gh-gei icon indicating copy to clipboard operation
gh-gei copied to clipboard

CSV parsing in `gh [gei|ado2gh|bbs2gh] reclaim-mannequin` rejects valid CSVs

Open timrogers opened this issue 2 years ago • 1 comments

Description

gh [gei|ado2gh|bbs2gh] reclaim-mannequin allows you to pass in a --csv of mannequins to reclaim, based on the template generated with gh [gei|ado2gh|bbs2gh] generate-mannequin-csv.

At the moment, this only works with CSVs that exactly match the template - for example, if you generate a CSV with the headers quoted (which is allowed in CSV files), it is rejected:

"mannequin-user","mannequin-id","target-user"
"tim","M_kgDOB65srg","timrogers"

This is because, when reading a provided CSV file, we effectively treat the input as text rather than parsing it as a CSV.

It's quite likely that you end up with quoted CSVs, for example if you build them programatically using PowerShell.

We should make the CSV parsing more tolerant.

Reproduction Steps

  1. Call gh [gei|ado2gh|bbs2gh] reclaim-mannequin --csv, passing in a CSV like the example above

timrogers avatar Apr 27 '23 11:04 timrogers

We should follow the same pattern for csv parsing that we do for ado2gh migrate-repo --repo-list repos.csv

https://github.com/github/gh-gei/blob/main/src/ado2gh/Services/AdoInspectorService.cs#L41

dylan-smith avatar Apr 27 '23 11:04 dylan-smith