0

I am trying to extract the issues from a repository (example: Tensorflow) that has a specific message/word on the commits/issues page. For example, I want to extract all the commits/issues that contain the word CVE from the Tensorflow repository and put them into a CSV file for analysis.

I have tried curl "https://api.github.com/repos/tensorflow/tensorflow/issues" but it only returns the first 30 issues instead of all.

I have taken a look at the Github API but I do not understand it well. Please help!

Zysora
  • 47
  • 1
  • 6
  • @LeGEC does this work for issues too? I am not sure how to export to csv using gitlog. – Zysora May 25 '21 at 08:11
  • I misread your question, I thought you were looking for a word in the *commit messages*. My bad. – LeGEC May 25 '21 at 08:16
  • @LeGEC I am also looking for a word in commit messages too so that helps for a part of the issue. For exporting to a csv, I first need to clone the repository then use grep for checking messages? – Zysora May 25 '21 at 08:18
  • To search commit messages : yes, this will be the easiest way – LeGEC May 25 '21 at 08:24

1 Answers1

0

The results are paged, there are two parameters per_page and page to the issues API :

per_page  integer    Results per page (max 100). Default: 30
page      integer    Page number of the results to fetch. Default: 1

Pass these along with your queries.

link to documentation :
https://docs.github.com/en/rest/reference/issues#list-issues-assigned-to-the-authenticated-user


To list the commits : simply clone the repo and list the commits using regular git commands (git log with the correct options)

LeGEC
  • 46,477
  • 5
  • 57
  • 104
  • Thank you. Is there a way to use Python or something to extract these issues? I am looking into https://github.com/PyGithub/PyGithub – Zysora May 25 '21 at 08:35
  • For the "how do I access this API ?" part : google for it. See for example : https://stackoverflow.com/questions/10625190/most-suitable-python-library-for-github-api-v3 ; `PyGithub` is probably a good candidate (but I have never used it) – LeGEC May 25 '21 at 08:55