如何从github V3获得给定拉请求的项目和链接问题?pulls
端点没有给出它们中任何一个的信息。在github的拉请求部分的侧栏中,提到了Projects
和Linked issues
。但我无法找到通过API调用获取这些信息的方法。
我想找出在成功合并时哪个请求关闭拉请求。
发布于 2020-03-20 19:29:20
要获得带有卡链接到特定拉请求的项目,可以使用Github GraphQL API使用以下有效负载:
{
repository(owner: "twbs", name: "bootstrap") {
pullRequest(number: 30342) {
projectCards {
nodes {
project {
name
}
}
}
}
}
}
但是对于链接问题,我不认为API是可用的。如果回购是公开的,您仍然可以从github.com中抓取列表。下面的python脚本使用美汤获取问题URL列表:
import requests
from bs4 import BeautifulSoup
import re
repo = "twbs/bootstrap"
pr = "30342"
r = requests.get(f"https://github.com/{repo}/pull/{pr}")
soup = BeautifulSoup(r.text, 'html.parser')
issueForm = soup.find("form", { "aria-label": re.compile('Link issues')})
print([ i["href"] for i in issueForm.find_all("a")])
发布于 2022-07-13 13:42:49
2022最新情况:
现在,在closingIssuesReferences请求中有一个GraphQL属性。
pullRequest(number: $number) {
id
closingIssuesReferences (first: 50) {
edges {
node {
id
body
number
title
}
}
}
}
发布于 2020-05-10 17:07:02
理论上,下面的查询应该返回问题的链接拉请求号。但是,它现在返回一条错误消息,提示内部错误。我在github开了张罚单。
(kode项目-konveyor/TaskMarket,第121期)
{
repository(owner: "kode-konveyor", name: "TaskMarket") {
issue(number: 121) {
id
number
title
timelineItems {
__typename
... on IssueTimelineItemsConnection {
nodes {
__typename
... on ConnectedEvent {
source {
__typename
... on PullRequest {
number
}
}
subject {
__typename
... on PullRequest {
number
}
}
}
}
}
}
}
}
}
https://stackoverflow.com/questions/60717142
复制相似问题