I use gh
command to list and print all issues to a CSV file, but I can't get the all assignees also.
The complete command I use:
gh issue list --limit 1000 --state all | tr '\t' ',' > issues.csv
Since the default output contains comma-separated labels and one issue can have more than one label, your approach (converting all tabs to commas) can result in a malformed CSV output. To fix just that, you could use a CSV-aware tool such as xsv:
gh issue list --state all | xsv fmt -d '\t' > issues.csv
This properly quotes fields containing a comma.
Now, to get assignees as well, you can use the --json
flag that lets you select which fields you want in the response, and --jq
to massage the JSON response into CSV format.
For example, to get number, state, title, timestamp of the last update, labels, and assignees:
gh issue list --state all \
--json number,state,title,labels,updatedAt,assignees \
--jq '
map([
.number,
.state,
.title,
.updatedAt,
(.labels | map(.name) | join(",")),
(.assignees | map(.login) | join(","))
])[]
| @csv
'