Search code examples
githubgithub-api

how to count weekly additions of lines using github api?


Reference: https://developer.github.com/v3/repos/statistics/#get-the-number-of-additions-and-deletions-per-week

I tried :https://api.github.com/repos/Md-Mudassir/cruiser/stats/code_frequency

Response:
[
  [
    1571529600,
    59258,
    -59151
  ],
  [
    1572134400,
    30660,
    -18359
  ],
  [
    1572739200,
    1688,
    -1731
  ],
  [
    1573344000,
    9087,
    -9371
  ],
  [
    1573948800,
    0,
    0
  ]
]

But I don't understand the response, how do I convert it so that it's readable?


Solution

  • This is composed of:

    • a Unix timestamp which refers to the start of the week for the next two numbers
    • the number of lines added
    • the number of lines removed.

    You must convert the Epoch number in order to derive the week.