Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse code reviews for approved Pull Request #2

Closed
h1alexbel opened this issue Mar 26, 2024 · 6 comments
Closed

Parse code reviews for approved Pull Request #2

h1alexbel opened this issue Mar 26, 2024 · 6 comments

Comments

@h1alexbel
Copy link
Contributor

h1alexbel commented Mar 26, 2024

when the Pull Request gets approved, we can pull all reviews for this pull request. For pull #58 in repo objectionary/news.eolang.org we can hit https://api.github.com/repos/objectionary/news.eolang.org/pulls/58/reviews endpoint to get all reviews. Something like this will be printed:

[
  {
    "id": 1928092753,
    "node_id": "PRR_kwDOHeCcq85y7FxR",
    "user": {
      "login": "volodya-lombrozo",
      "id": 51804353,
      "node_id": "MDQ6VXNlcjUxODA0MzUz",
      "avatar_url": "https://avatars.githubusercontent.com/u/51804353?u=ba6eeac8539c54695c2da9ffe27443686daacda0&v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/volodya-lombrozo",
      "html_url": "https://github.com/volodya-lombrozo",
      "followers_url": "https://api.github.com/users/volodya-lombrozo/followers",
      "following_url": "https://api.github.com/users/volodya-lombrozo/following{/other_user}",
      "gists_url": "https://api.github.com/users/volodya-lombrozo/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/volodya-lombrozo/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/volodya-lombrozo/subscriptions",
      "organizations_url": "https://api.github.com/users/volodya-lombrozo/orgs",
      "repos_url": "https://api.github.com/users/volodya-lombrozo/repos",
      "events_url": "https://api.github.com/users/volodya-lombrozo/events{/privacy}",
      "received_events_url": "https://api.github.com/users/volodya-lombrozo/received_events",
      "type": "User",
      "site_admin": false
    },
    "body": "@Yanich96 Please, check all the grammar mistakes in this text.",
    "state": "CHANGES_REQUESTED",
    "html_url": "https://github.com/objectionary/news.eolang.org/pull/58#pullrequestreview-1928092753",
    "pull_request_url": "https://api.github.com/repos/objectionary/news.eolang.org/pulls/58",
    "author_association": "MEMBER",
    "_links": {
      "html": {
        "href": "https://github.com/objectionary/news.eolang.org/pull/58#pullrequestreview-1928092753"
      },
      "pull_request": {
        "href": "https://api.github.com/repos/objectionary/news.eolang.org/pulls/58"
      }
    },
    "submitted_at": "2024-03-11T15:35:05Z",
    "commit_id": "96e9f05a91df6602ce876ba0fc52a5ccb05e1b34"
  },
  {
    "id": 1933376078,
    "node_id": "PRR_kwDOHeCcq85zPPpO",
    "user": {
      "login": "Yanich96",
      "id": 51863344,
      "node_id": "MDQ6VXNlcjUxODYzMzQ0",
      "avatar_url": "https://avatars.githubusercontent.com/u/51863344?u=0234435a770321c7adf4476f27ef0fc5c1e1aeaf&v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/Yanich96",
      "html_url": "https://github.com/Yanich96",
      "followers_url": "https://api.github.com/users/Yanich96/followers",
      "following_url": "https://api.github.com/users/Yanich96/following{/other_user}",
      "gists_url": "https://api.github.com/users/Yanich96/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/Yanich96/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/Yanich96/subscriptions",
      "organizations_url": "https://api.github.com/users/Yanich96/orgs",
      "repos_url": "https://api.github.com/users/Yanich96/repos",
      "events_url": "https://api.github.com/users/Yanich96/events{/privacy}",
      "received_events_url": "https://api.github.com/users/Yanich96/received_events",
      "type": "User",
      "site_admin": false
    },
    "body": "",
    "state": "COMMENTED",
    "html_url": "https://github.com/objectionary/news.eolang.org/pull/58#pullrequestreview-1933376078",
    "pull_request_url": "https://api.github.com/repos/objectionary/news.eolang.org/pulls/58",
    "author_association": "NONE",
    "_links": {
      "html": {
        "href": "https://github.com/objectionary/news.eolang.org/pull/58#pullrequestreview-1933376078"
      },
      "pull_request": {
        "href": "https://api.github.com/repos/objectionary/news.eolang.org/pulls/58"
      }
    },
    "submitted_at": "2024-03-13T07:56:08Z",
    "commit_id": "96e9f05a91df6602ce876ba0fc52a5ccb05e1b34"
  },
  ...
  {
    "id": 1958450376,
    "node_id": "PRR_kwDOHeCcq850u5TI",
    "user": {
      "login": "Yanich96",
      "id": 51863344,
      "node_id": "MDQ6VXNlcjUxODYzMzQ0",
      "avatar_url": "https://avatars.githubusercontent.com/u/51863344?u=0234435a770321c7adf4476f27ef0fc5c1e1aeaf&v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/Yanich96",
      "html_url": "https://github.com/Yanich96",
      "followers_url": "https://api.github.com/users/Yanich96/followers",
      "following_url": "https://api.github.com/users/Yanich96/following{/other_user}",
      "gists_url": "https://api.github.com/users/Yanich96/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/Yanich96/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/Yanich96/subscriptions",
      "organizations_url": "https://api.github.com/users/Yanich96/orgs",
      "repos_url": "https://api.github.com/users/Yanich96/repos",
      "events_url": "https://api.github.com/users/Yanich96/events{/privacy}",
      "received_events_url": "https://api.github.com/users/Yanich96/received_events",
      "type": "User",
      "site_admin": false
    },
    "body": "",
    "state": "COMMENTED",
    "html_url": "https://github.com/objectionary/news.eolang.org/pull/58#pullrequestreview-1958450376",
    "pull_request_url": "https://api.github.com/repos/objectionary/news.eolang.org/pulls/58",
    "author_association": "NONE",
    "_links": {
      "html": {
        "href": "https://github.com/objectionary/news.eolang.org/pull/58#pullrequestreview-1958450376"
      },
      "pull_request": {
        "href": "https://api.github.com/repos/objectionary/news.eolang.org/pulls/58"
      }
    },
    "submitted_at": "2024-03-25T18:04:11Z",
    "commit_id": "9e6a73624414b68d4b2dc856bab6a984ee39b0bb"
  }
]

As you can see here, each review has its id, using that we can fetch all the review comments, utilizing https://api.github.com/repos/objectionary/news.eolang.org/pulls/58/reviews/${ID}/comments endpoint. Here is a review with id=1928092753:

[
  {
    "id": 1519878734,
    "node_id": "PRRC_kwDOHeCcq85al4JO",
    "url": "https://api.github.com/repos/objectionary/news.eolang.org/pulls/comments/1519878734",
    "pull_request_review_id": 1928092753,
    "diff_hunk": "@@ -0,0 +1,241 @@\n+---\n+layout: post\n+date: 2024-02-06\n+title: \"Build cache in EO and other build systems\"\n+author: Alekseeva Yana\n+---\n+\n+\n+## Introduction\n+Wasting a lot of time on building a project is a programming problem. At the moment a programmer starts an",
    "path": "_posts/2024/2024-02-06-about-caching-in-eo.md",
    "position": null,
    "original_position": 10,
    "commit_id": "9e6a73624414b68d4b2dc856bab6a984ee39b0bb",
    "user": {
      "login": "volodya-lombrozo",
      "id": 51804353,
      "node_id": "MDQ6VXNlcjUxODA0MzUz",
      "avatar_url": "https://avatars.githubusercontent.com/u/51804353?u=ba6eeac8539c54695c2da9ffe27443686daacda0&v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/volodya-lombrozo",
      "html_url": "https://github.com/volodya-lombrozo",
      "followers_url": "https://api.github.com/users/volodya-lombrozo/followers",
      "following_url": "https://api.github.com/users/volodya-lombrozo/following{/other_user}",
      "gists_url": "https://api.github.com/users/volodya-lombrozo/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/volodya-lombrozo/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/volodya-lombrozo/subscriptions",
      "organizations_url": "https://api.github.com/users/volodya-lombrozo/orgs",
      "repos_url": "https://api.github.com/users/volodya-lombrozo/repos",
      "events_url": "https://api.github.com/users/volodya-lombrozo/events{/privacy}",
      "received_events_url": "https://api.github.com/users/volodya-lombrozo/received_events",
      "type": "User",
      "site_admin": false
    },
    "body": "@Yanich96 \r\n\r\n> Wasting a lot of time on building a project is a programming problem. At the moment a programmer starts an assembly, he loses focus on a task and spends valuable working \r\n\r\n\"Empty words\". We can remove them without losing any meaning.",
    "created_at": "2024-03-11T15:04:52Z",
    "updated_at": "2024-03-11T15:35:05Z",
    "html_url": "https://github.com/objectionary/news.eolang.org/pull/58#discussion_r1519878734",
    "pull_request_url": "https://api.github.com/repos/objectionary/news.eolang.org/pulls/58",
    "author_association": "MEMBER",
    "_links": {
      "self": {
        "href": "https://api.github.com/repos/objectionary/news.eolang.org/pulls/comments/1519878734"
      },
      "html": {
        "href": "https://github.com/objectionary/news.eolang.org/pull/58#discussion_r1519878734"
      },
      "pull_request": {
        "href": "https://api.github.com/repos/objectionary/news.eolang.org/pulls/58"
      }
    },
    "original_commit_id": "96e9f05a91df6602ce876ba0fc52a5ccb05e1b34",
    "reactions": {
      "url": "https://api.github.com/repos/objectionary/news.eolang.org/pulls/comments/1519878734/reactions",
      "total_count": 1,
      "+1": 0,
      "-1": 0,
      "laugh": 0,
      "hooray": 0,
      "confused": 0,
      "heart": 0,
      "rocket": 0,
      "eyes": 1
    }
  },
  ...
  {
    "id": 1519926533,
    "node_id": "PRRC_kwDOHeCcq85amD0F",
    "url": "https://api.github.com/repos/objectionary/news.eolang.org/pulls/comments/1519926533",
    "pull_request_review_id": 1928092753,
    "diff_hunk": "@@ -0,0 +1,241 @@\n+---\n+layout: post\n+date: 2024-02-06\n+title: \"Build cache in EO and other build systems\"\n+author: Alekseeva Yana\n+---\n+\n+\n+## Introduction\n+Wasting a lot of time on building a project is a programming problem. At the moment a programmer starts an\n+assembly, he loses focus on a task and spends valuable working time. Different build systems use many tools,\n+helping to assemble a project faster, namely caching, task parallelization, distributed building and much more.\n+The subject of this article is caching, because completed tasks caching allows not to spend resources again. \n+So in [EO](https://github.com/objectionary/eo) caching is used for speeding up programs work.\n+While developing [EO](https://github.com/objectionary/eo) we found caching errors in `eo-maven-plugin`\n+for EO version `0.34.0`. The error occurred, because using a file name and comparing equality of\n+compilation time and caching time is not the most reliable verification. Unit tests were written showing that \n+cache does not work correctly. Also reading a file was necessary for getting a programme name \n+that slowed down an assembly. \n+That we came to conclusion that we need caching with a reliable verification which does not require reading a file\n+from disk. And using cache should save us enough time for building a project.\n+\n+The goal of this article is to research caching in frequently used build systems (`ccache`, `Maven`, `Gradle`)",
    "path": "_posts/2024/2024-02-06-about-caching-in-eo.md",
    "position": null,
    "original_position": 23,
    "commit_id": "9e6a73624414b68d4b2dc856bab6a984ee39b0bb",
    "user": {
      "login": "volodya-lombrozo",
      "id": 51804353,
      "node_id": "MDQ6VXNlcjUxODA0MzUz",
      "avatar_url": "https://avatars.githubusercontent.com/u/51804353?u=ba6eeac8539c54695c2da9ffe27443686daacda0&v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/volodya-lombrozo",
      "html_url": "https://github.com/volodya-lombrozo",
      "followers_url": "https://api.github.com/users/volodya-lombrozo/followers",
      "following_url": "https://api.github.com/users/volodya-lombrozo/following{/other_user}",
      "gists_url": "https://api.github.com/users/volodya-lombrozo/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/volodya-lombrozo/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/volodya-lombrozo/subscriptions",
      "organizations_url": "https://api.github.com/users/volodya-lombrozo/orgs",
      "repos_url": "https://api.github.com/users/volodya-lombrozo/repos",
      "events_url": "https://api.github.com/users/volodya-lombrozo/events{/privacy}",
      "received_events_url": "https://api.github.com/users/volodya-lombrozo/received_events",
      "type": "User",
      "site_admin": false
    },
    "body": "@Yanich96 This sentence might be connected with the previous one: \"The subject of this article is caching.\"",
    "created_at": "2024-03-11T15:34:26Z",
    "updated_at": "2024-03-11T15:35:06Z",
    "html_url": "https://github.com/objectionary/news.eolang.org/pull/58#discussion_r1519926533",
    "pull_request_url": "https://api.github.com/repos/objectionary/news.eolang.org/pulls/58",
    "author_association": "MEMBER",
    "_links": {
      "self": {
        "href": "https://api.github.com/repos/objectionary/news.eolang.org/pulls/comments/1519926533"
      },
      "html": {
        "href": "https://github.com/objectionary/news.eolang.org/pull/58#discussion_r1519926533"
      },
      "pull_request": {
        "href": "https://api.github.com/repos/objectionary/news.eolang.org/pulls/58"
      }
    },
    "original_commit_id": "96e9f05a91df6602ce876ba0fc52a5ccb05e1b34",
    "reactions": {
      "url": "https://api.github.com/repos/objectionary/news.eolang.org/pulls/comments/1519926533/reactions",
      "total_count": 0,
      "+1": 0,
      "-1": 0,
      "laugh": 0,
      "hooray": 0,
      "confused": 0,
      "heart": 0,
      "rocket": 0,
      "eyes": 0
    }
  }
]

This operation we should execute for all reviews in pull requests. After all comments are collected, let's group them with their review id and reviewer (github login)

h1alexbel pushed a commit that referenced this issue Mar 29, 2024
h1alexbel pushed a commit that referenced this issue Mar 29, 2024
h1alexbel pushed a commit that referenced this issue Mar 29, 2024
h1alexbel pushed a commit that referenced this issue Mar 29, 2024
h1alexbel pushed a commit that referenced this issue Mar 29, 2024
h1alexbel pushed a commit that referenced this issue Mar 29, 2024
h1alexbel pushed a commit that referenced this issue Mar 29, 2024
h1alexbel pushed a commit that referenced this issue Mar 29, 2024
h1alexbel added a commit that referenced this issue Mar 29, 2024
feat(#2, #6): more puzzles, delete EntryTest.java
@0pdd
Copy link
Collaborator

0pdd commented Mar 29, 2024

@h1alexbel 4 puzzles #22, #23, #24, #25 are still not solved.

h1alexbel pushed a commit that referenced this issue Apr 1, 2024
h1alexbel pushed a commit that referenced this issue Apr 1, 2024
h1alexbel pushed a commit that referenced this issue Apr 1, 2024
h1alexbel added a commit that referenced this issue Apr 1, 2024
feat(#2): JsonComments, comments per review id, cov up to 0.5
h1alexbel pushed a commit that referenced this issue Apr 1, 2024
h1alexbel pushed a commit that referenced this issue Apr 1, 2024
h1alexbel pushed a commit that referenced this issue Apr 1, 2024
h1alexbel added a commit that referenced this issue Apr 1, 2024
h1alexbel pushed a commit that referenced this issue Apr 1, 2024
h1alexbel added a commit that referenced this issue Apr 1, 2024
feat(#2): input github token typo
h1alexbel pushed a commit that referenced this issue Apr 1, 2024
h1alexbel pushed a commit that referenced this issue Apr 1, 2024
h1alexbel pushed a commit that referenced this issue Apr 1, 2024
h1alexbel added a commit that referenced this issue Apr 1, 2024
feat(#2): transformed reviews with comments, class renames
@0pdd
Copy link
Collaborator

0pdd commented Apr 1, 2024

@h1alexbel 3 puzzles #22, #23, #25 are still not solved; solved: #24.

@0pdd
Copy link
Collaborator

0pdd commented Apr 2, 2024

@h1alexbel 4 puzzles #23, #25, #35, #36 are still not solved; solved: #22, #24.

@0pdd
Copy link
Collaborator

0pdd commented Apr 3, 2024

@h1alexbel 3 puzzles #23, #25, #35 are still not solved; solved: #22, #24, #36.

@0pdd
Copy link
Collaborator

0pdd commented Apr 8, 2024

@h1alexbel 2 puzzles #23, #35 are still not solved; solved: #22, #24, #25, #36.

@0pdd
Copy link
Collaborator

0pdd commented Apr 10, 2024

@h1alexbel the puzzle #35 is still not solved; solved: #22, #23, #24, #25, #36.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants