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

Differentiate between issues and PRs #60

Closed Tarun-Bhardwaj closed 2 years ago

Tarun-Bhardwaj commented 3 years ago

I was able to successfully download the CSV but it contains both PRs and issues from my repo. Though PRs are also the same as issues in GitHub but is there a way in the extract we can differentiate between the two?

gavinr commented 2 years ago

We use the octokit.rest.issues.listForRepo endpoint: https://octokit.github.io/rest.js/v18#issues-list-for-repo

It says:

Note: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the pull_request key. Be aware that the id of a pull request returned from "Issues" endpoints will be an issue id. To find out the pull request id, use the "List pull requests" endpoint.

Have you tried the --exportAll option to see if that "pull_request key" is present?

gavinr commented 2 years ago

Yes, I just verified that if you use the --exportAll option, you can see that PRs have the pull_request.url column filled, and issues do not. I'm going to say that's a good workflow for this use case.