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

Add a table to show relation between GitHub issue and PR #1257

Closed
Startrekzky opened this issue Feb 21, 2022 · 1 comment
Closed

Add a table to show relation between GitHub issue and PR #1257

Startrekzky opened this issue Feb 21, 2022 · 1 comment
Assignees
Labels
type/feature-request This issue is a proposal for something new

Comments

@Startrekzky
Copy link
Contributor

Startrekzky commented Feb 21, 2022

Description

Add a table to show the relation between GitHub issue and PR, so that users can know the relation between these 2 entities.

Describe the solution you'd like

It's a domain layer table, the relation is transformed by issue events like the pic below

  1. This issue is fixed by PR 31731

    image

  2. This issue is mentioned in PR 31753, 31754, 31755, etc.
    image

  3. Table design

  • Table name: pull_request_issue
  • 2 columns:
    • pull_request_id
    • issue_id

Describe alternatives you've considered

The relation between PR and issue is only for Github

@Startrekzky Startrekzky added the type/feature-request This issue is a proposal for something new label Feb 21, 2022
@warren830
Copy link
Contributor

warren830 commented Feb 21, 2022

After investigation, we can get all info of issues from issues/{number}/timeline:
https://api.github.com/repos/pingcap/tidb/issues/31467/timeline
In the response of this link, we can get event objects, and only the event object contains source.issue.pull_request are prs related to the issue, an example looks like the below(I deleted useless info):
{
"actor": {
"login": "ti-srebot",
"id": 66930949,
"node_id": "MDQ6VXNlcjY2OTMwOTQ5",
"avatar_url": "https://avatars.githubusercontent.com/u/66930949?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/ti-srebot",
"html_url": "https://github.com/ti-srebot",
"followers_url": "https://api.github.com/users/ti-srebot/followers",
"following_url": "https://api.github.com/users/ti-srebot/following{/other_user}",
"gists_url": "https://api.github.com/users/ti-srebot/gists{/gist_id}",
"starred_url": "https://api.github.com/users/ti-srebot/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/ti-srebot/subscriptions",
"organizations_url": "https://api.github.com/users/ti-srebot/orgs",
"repos_url": "https://api.github.com/users/ti-srebot/repos",
"events_url": "https://api.github.com/users/ti-srebot/events{/privacy}",
"received_events_url": "https://api.github.com/users/ti-srebot/received_events",
"type": "User",
"site_admin": false
},
"created_at": "2022-01-17T15:58:25Z",
"updated_at": "2022-01-17T15:58:25Z",
"source": {
"type": "issue",
"issue": {
"number": 31757,
"pull_request": {
"url": "https://api.github.com/repos/pingcap/tidb/pulls/31757",
"html_url": "pingcap/tidb#31757",
"diff_url": "https://github.com/pingcap/tidb/pull/31757.diff",
"patch_url": "https://github.com/pingcap/tidb/pull/31757.patch",
"merged_at": null
},
}
},
"event": "cross-referenced"
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature-request This issue is a proposal for something new
Projects
None yet
2 participants