mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
[GHF][BE] Use GraphQL fragments (#77945)
Introduce `PRReviews`, `PRCheckSuites` and `CommitAuthors` fragments This avoids code duplication and possibility ones query will look different for paginated subquery vs default one Pull Request resolved: https://github.com/pytorch/pytorch/pull/77945 Approved by: https://github.com/seemethere
This commit is contained in:
parent
64c741e202
commit
bee26da294
2 changed files with 103 additions and 138 deletions
44
.github/scripts/gql_mocks.json
generated
vendored
44
.github/scripts/gql_mocks.json
generated
vendored
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"query_sha=41e3ed9a53b34f19266d6e8f46b546d3cb415cf8c388043d7ff445d4aa141fff name=pytorch number=73811 owner=pytorch": {
|
||||
"query_sha=d846cea8f3c737f04cb05db7b8ec8d35ef4ad406929f872c7058089c449c9fc8 name=pytorch number=73811 owner=pytorch": {
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequest": {
|
||||
|
|
@ -405,7 +405,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"query_sha=ee92ae407815151aa38d7e77e428cba977762d28d7c71cde2a2e72a9e9c29899 cursor=Y3Vyc29yOnYyOpHPAAAAAVFCcQU= name=pytorch number=73811 owner=pytorch": {
|
||||
"query_sha=4fa42dda073cf7ac75b2bbf595a8ef67b6dfff4bd248668750ff33ea913bf75f cursor=Y3Vyc29yOnYyOpHPAAAAAVFCcQU= name=pytorch number=73811 owner=pytorch": {
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequest": {
|
||||
|
|
@ -707,7 +707,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"query_sha=ee92ae407815151aa38d7e77e428cba977762d28d7c71cde2a2e72a9e9c29899 cursor=Y3Vyc29yOnYyOpHPAAAAAVFCcRI= name=pytorch number=73811 owner=pytorch": {
|
||||
"query_sha=4fa42dda073cf7ac75b2bbf595a8ef67b6dfff4bd248668750ff33ea913bf75f cursor=Y3Vyc29yOnYyOpHPAAAAAVFCcRI= name=pytorch number=73811 owner=pytorch": {
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequest": {
|
||||
|
|
@ -1071,7 +1071,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"query_sha=ee92ae407815151aa38d7e77e428cba977762d28d7c71cde2a2e72a9e9c29899 cursor=Y3Vyc29yOnYyOpHPAAAAAVFCcSI= name=pytorch number=73811 owner=pytorch": {
|
||||
"query_sha=4fa42dda073cf7ac75b2bbf595a8ef67b6dfff4bd248668750ff33ea913bf75f cursor=Y3Vyc29yOnYyOpHPAAAAAVFCcSI= name=pytorch number=73811 owner=pytorch": {
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequest": {
|
||||
|
|
@ -1440,7 +1440,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"query_sha=ee92ae407815151aa38d7e77e428cba977762d28d7c71cde2a2e72a9e9c29899 cursor=Y3Vyc29yOnYyOpHPAAAAAVFCcS8= name=pytorch number=73811 owner=pytorch": {
|
||||
"query_sha=4fa42dda073cf7ac75b2bbf595a8ef67b6dfff4bd248668750ff33ea913bf75f cursor=Y3Vyc29yOnYyOpHPAAAAAVFCcS8= name=pytorch number=73811 owner=pytorch": {
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequest": {
|
||||
|
|
@ -1782,7 +1782,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"query_sha=ee92ae407815151aa38d7e77e428cba977762d28d7c71cde2a2e72a9e9c29899 cursor=Y3Vyc29yOnYyOpHPAAAAAVFCdAA= name=pytorch number=73811 owner=pytorch": {
|
||||
"query_sha=4fa42dda073cf7ac75b2bbf595a8ef67b6dfff4bd248668750ff33ea913bf75f cursor=Y3Vyc29yOnYyOpHPAAAAAVFCdAA= name=pytorch number=73811 owner=pytorch": {
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequest": {
|
||||
|
|
@ -2017,7 +2017,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"query_sha=41e3ed9a53b34f19266d6e8f46b546d3cb415cf8c388043d7ff445d4aa141fff name=pytorch number=31093 owner=pytorch": {
|
||||
"query_sha=d846cea8f3c737f04cb05db7b8ec8d35ef4ad406929f872c7058089c449c9fc8 name=pytorch number=31093 owner=pytorch": {
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequest": {
|
||||
|
|
@ -3002,7 +3002,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"query_sha=41e3ed9a53b34f19266d6e8f46b546d3cb415cf8c388043d7ff445d4aa141fff name=pytorch number=76118 owner=pytorch": {
|
||||
"query_sha=d846cea8f3c737f04cb05db7b8ec8d35ef4ad406929f872c7058089c449c9fc8 name=pytorch number=76118 owner=pytorch": {
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequest": {
|
||||
|
|
@ -5088,7 +5088,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"query_sha=9a7ea963024cb39819e4a560d8d95f41bb3e0dad12c6f05539a994d6f7c38c34 cursor=MTAw name=pytorch number=76118 owner=pytorch": {
|
||||
"query_sha=74bd29fe945c49fde4818e873fa62bc60b55b4ef6ae3f2bb719bab6cddbaa7ce cursor=MTAw name=pytorch number=76118 owner=pytorch": {
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequest": {
|
||||
|
|
@ -5468,7 +5468,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"query_sha=41e3ed9a53b34f19266d6e8f46b546d3cb415cf8c388043d7ff445d4aa141fff name=pytorch number=76123 owner=pytorch": {
|
||||
"query_sha=d846cea8f3c737f04cb05db7b8ec8d35ef4ad406929f872c7058089c449c9fc8 name=pytorch number=76123 owner=pytorch": {
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequest": {
|
||||
|
|
@ -7009,7 +7009,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"query_sha=cc0db92500f836c7fc4f9a0235a75b77562e6e4ab939b5cbe5584078df1c22d2 cursor=Y3Vyc29yOnYyOpO5MjAyMi0wNC0yNVQxMTozNTowMS0wNzowMLkyMDIyLTA0LTI1VDExOjM1OjAwLTA3OjAwzjjC2d0= name=pytorch number=76123 owner=pytorch": {
|
||||
"query_sha=6a8ce6412a780d5804bfe180ed1dc807269e1eae2ae50de2346d56d1283884bc cursor=Y3Vyc29yOnYyOpO5MjAyMi0wNC0yNVQxMTozNTowMS0wNzowMLkyMDIyLTA0LTI1VDExOjM1OjAwLTA3OjAwzjjC2d0= name=pytorch number=76123 owner=pytorch": {
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequest": {
|
||||
|
|
@ -7079,7 +7079,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"query_sha=41e3ed9a53b34f19266d6e8f46b546d3cb415cf8c388043d7ff445d4aa141fff name=pytorch number=71759 owner=pytorch": {
|
||||
"query_sha=d846cea8f3c737f04cb05db7b8ec8d35ef4ad406929f872c7058089c449c9fc8 name=pytorch number=71759 owner=pytorch": {
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequest": {
|
||||
|
|
@ -7904,7 +7904,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"query_sha=41e3ed9a53b34f19266d6e8f46b546d3cb415cf8c388043d7ff445d4aa141fff name=pytorch number=75095 owner=pytorch": {
|
||||
"query_sha=d846cea8f3c737f04cb05db7b8ec8d35ef4ad406929f872c7058089c449c9fc8 name=pytorch number=75095 owner=pytorch": {
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequest": {
|
||||
|
|
@ -9317,7 +9317,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"query_sha=41e3ed9a53b34f19266d6e8f46b546d3cb415cf8c388043d7ff445d4aa141fff name=pytorch number=77700 owner=pytorch": {
|
||||
"query_sha=d846cea8f3c737f04cb05db7b8ec8d35ef4ad406929f872c7058089c449c9fc8 name=pytorch number=77700 owner=pytorch": {
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequest": {
|
||||
|
|
@ -10118,7 +10118,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"query_sha=41e3ed9a53b34f19266d6e8f46b546d3cb415cf8c388043d7ff445d4aa141fff name=pytorch number=68111 owner=pytorch": {
|
||||
"query_sha=d846cea8f3c737f04cb05db7b8ec8d35ef4ad406929f872c7058089c449c9fc8 name=pytorch number=68111 owner=pytorch": {
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequest": {
|
||||
|
|
@ -11997,7 +11997,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"query_sha=41e3ed9a53b34f19266d6e8f46b546d3cb415cf8c388043d7ff445d4aa141fff name=pytorch number=73969 owner=pytorch": {
|
||||
"query_sha=d846cea8f3c737f04cb05db7b8ec8d35ef4ad406929f872c7058089c449c9fc8 name=pytorch number=73969 owner=pytorch": {
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequest": {
|
||||
|
|
@ -12508,7 +12508,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"query_sha=ee92ae407815151aa38d7e77e428cba977762d28d7c71cde2a2e72a9e9c29899 cursor=Y3Vyc29yOnYyOpHPAAAAAU2F-RA= name=pytorch number=73969 owner=pytorch": {
|
||||
"query_sha=4fa42dda073cf7ac75b2bbf595a8ef67b6dfff4bd248668750ff33ea913bf75f cursor=Y3Vyc29yOnYyOpHPAAAAAU2F-RA= name=pytorch number=73969 owner=pytorch": {
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequest": {
|
||||
|
|
@ -12898,7 +12898,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"query_sha=ee92ae407815151aa38d7e77e428cba977762d28d7c71cde2a2e72a9e9c29899 cursor=Y3Vyc29yOnYyOpHPAAAAAU2F-SU= name=pytorch number=73969 owner=pytorch": {
|
||||
"query_sha=4fa42dda073cf7ac75b2bbf595a8ef67b6dfff4bd248668750ff33ea913bf75f cursor=Y3Vyc29yOnYyOpHPAAAAAU2F-SU= name=pytorch number=73969 owner=pytorch": {
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequest": {
|
||||
|
|
@ -13034,7 +13034,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"query_sha=41e3ed9a53b34f19266d6e8f46b546d3cb415cf8c388043d7ff445d4aa141fff name=pytorch number=73099 owner=pytorch": {
|
||||
"query_sha=d846cea8f3c737f04cb05db7b8ec8d35ef4ad406929f872c7058089c449c9fc8 name=pytorch number=73099 owner=pytorch": {
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequest": {
|
||||
|
|
@ -14027,7 +14027,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"query_sha=41e3ed9a53b34f19266d6e8f46b546d3cb415cf8c388043d7ff445d4aa141fff name=pytorch number=74649 owner=pytorch": {
|
||||
"query_sha=d846cea8f3c737f04cb05db7b8ec8d35ef4ad406929f872c7058089c449c9fc8 name=pytorch number=74649 owner=pytorch": {
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequest": {
|
||||
|
|
@ -16059,7 +16059,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"query_sha=ee92ae407815151aa38d7e77e428cba977762d28d7c71cde2a2e72a9e9c29899 cursor=Y3Vyc29yOnYyOpHPAAAAAUK_Uc0= name=pytorch number=71759 owner=pytorch": {
|
||||
"query_sha=4fa42dda073cf7ac75b2bbf595a8ef67b6dfff4bd248668750ff33ea913bf75f cursor=Y3Vyc29yOnYyOpHPAAAAAUK_Uc0= name=pytorch number=71759 owner=pytorch": {
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequest": {
|
||||
|
|
@ -16443,7 +16443,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"query_sha=ee92ae407815151aa38d7e77e428cba977762d28d7c71cde2a2e72a9e9c29899 cursor=Y3Vyc29yOnYyOpHPAAAAAUK_Uec= name=pytorch number=71759 owner=pytorch": {
|
||||
"query_sha=4fa42dda073cf7ac75b2bbf595a8ef67b6dfff4bd248668750ff33ea913bf75f cursor=Y3Vyc29yOnYyOpHPAAAAAUK_Uec= name=pytorch number=71759 owner=pytorch": {
|
||||
"data": {
|
||||
"repository": {
|
||||
"pullRequest": {
|
||||
|
|
|
|||
197
.github/scripts/trymerge.py
vendored
197
.github/scripts/trymerge.py
vendored
|
|
@ -14,7 +14,78 @@ from functools import lru_cache
|
|||
from warnings import warn
|
||||
|
||||
|
||||
GH_GET_PR_INFO_QUERY = """
|
||||
GH_PR_REVIEWS_FRAGMENT = """
|
||||
fragment PRReviews on PullRequestReviewConnection {
|
||||
nodes {
|
||||
author {
|
||||
login
|
||||
}
|
||||
state
|
||||
}
|
||||
pageInfo {
|
||||
startCursor
|
||||
hasPreviousPage
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
GH_CHECKSUITES_FRAGMENT = """
|
||||
fragment PRCheckSuites on CheckSuiteConnection {
|
||||
edges {
|
||||
node {
|
||||
app {
|
||||
name
|
||||
databaseId
|
||||
}
|
||||
workflowRun {
|
||||
workflow {
|
||||
name
|
||||
}
|
||||
}
|
||||
checkRuns(first: 50) {
|
||||
nodes {
|
||||
name
|
||||
conclusion
|
||||
detailsUrl
|
||||
}
|
||||
pageInfo {
|
||||
endCursor
|
||||
hasNextPage
|
||||
}
|
||||
}
|
||||
conclusion
|
||||
url
|
||||
}
|
||||
cursor
|
||||
}
|
||||
pageInfo {
|
||||
hasNextPage
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
GH_COMMIT_AUTHORS_FRAGMENT = """
|
||||
fragment CommitAuthors on PullRequestCommitConnection {
|
||||
nodes {
|
||||
commit {
|
||||
author {
|
||||
user {
|
||||
login
|
||||
}
|
||||
email
|
||||
name
|
||||
}
|
||||
oid
|
||||
}
|
||||
}
|
||||
pageInfo {
|
||||
endCursor
|
||||
hasNextPage
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
GH_GET_PR_INFO_QUERY = GH_PR_REVIEWS_FRAGMENT + GH_CHECKSUITES_FRAGMENT + GH_COMMIT_AUTHORS_FRAGMENT + """
|
||||
query ($owner: String!, $name: String!, $number: Int!) {
|
||||
repository(owner: $owner, name: $name) {
|
||||
pullRequest(number: $number) {
|
||||
|
|
@ -41,58 +112,14 @@ query ($owner: String!, $name: String!, $number: Int!) {
|
|||
oid
|
||||
}
|
||||
commits_with_authors:commits(first: 100) {
|
||||
nodes {
|
||||
commit {
|
||||
author {
|
||||
user {
|
||||
login
|
||||
}
|
||||
email
|
||||
name
|
||||
}
|
||||
oid
|
||||
}
|
||||
}
|
||||
pageInfo {
|
||||
endCursor
|
||||
hasNextPage
|
||||
}
|
||||
...CommitAuthors
|
||||
totalCount
|
||||
}
|
||||
commits(last: 1) {
|
||||
nodes {
|
||||
commit {
|
||||
checkSuites(first: 10) {
|
||||
edges {
|
||||
node {
|
||||
app {
|
||||
name
|
||||
databaseId
|
||||
}
|
||||
workflowRun {
|
||||
workflow {
|
||||
name
|
||||
}
|
||||
}
|
||||
checkRuns(first: 50) {
|
||||
nodes {
|
||||
name
|
||||
conclusion
|
||||
detailsUrl
|
||||
}
|
||||
pageInfo {
|
||||
endCursor
|
||||
hasNextPage
|
||||
}
|
||||
}
|
||||
conclusion
|
||||
url
|
||||
}
|
||||
cursor
|
||||
}
|
||||
pageInfo {
|
||||
hasNextPage
|
||||
}
|
||||
...PRCheckSuites
|
||||
}
|
||||
oid
|
||||
}
|
||||
|
|
@ -109,16 +136,7 @@ query ($owner: String!, $name: String!, $number: Int!) {
|
|||
}
|
||||
}
|
||||
reviews(last: 100) {
|
||||
nodes {
|
||||
author {
|
||||
login
|
||||
}
|
||||
state
|
||||
}
|
||||
pageInfo {
|
||||
startCursor
|
||||
hasPreviousPage
|
||||
}
|
||||
...PRReviews
|
||||
}
|
||||
comments(last: 5) {
|
||||
nodes {
|
||||
|
|
@ -160,7 +178,7 @@ query ($owner: String!, $name: String!, $number: Int!, $cursor: String!) {
|
|||
}
|
||||
"""
|
||||
|
||||
GH_GET_PR_NEXT_CHECKSUITES = """
|
||||
GH_GET_PR_NEXT_CHECKSUITES = GH_CHECKSUITES_FRAGMENT + """
|
||||
query ($owner: String!, $name: String!, $number: Int!, $cursor: String!) {
|
||||
repository(name: $name, owner: $owner) {
|
||||
pullRequest(number: $number) {
|
||||
|
|
@ -169,36 +187,7 @@ query ($owner: String!, $name: String!, $number: Int!, $cursor: String!) {
|
|||
commit {
|
||||
oid
|
||||
checkSuites(first: 10, after: $cursor) {
|
||||
edges {
|
||||
node {
|
||||
app {
|
||||
name
|
||||
databaseId
|
||||
}
|
||||
workflowRun {
|
||||
workflow {
|
||||
name
|
||||
}
|
||||
}
|
||||
checkRuns(first: 50) {
|
||||
nodes {
|
||||
name
|
||||
conclusion
|
||||
detailsUrl
|
||||
}
|
||||
pageInfo {
|
||||
endCursor
|
||||
hasNextPage
|
||||
}
|
||||
}
|
||||
conclusion
|
||||
url
|
||||
}
|
||||
cursor
|
||||
}
|
||||
pageInfo {
|
||||
hasNextPage
|
||||
}
|
||||
...PRCheckSuites
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -285,48 +274,24 @@ query($org: String!, $name: String!, $cursor: String) {
|
|||
}
|
||||
"""
|
||||
|
||||
GH_GET_PR_NEXT_AUTHORS_QUERY = """
|
||||
GH_GET_PR_NEXT_AUTHORS_QUERY = GH_COMMIT_AUTHORS_FRAGMENT + """
|
||||
query ($owner: String!, $name: String!, $number: Int!, $cursor: String) {
|
||||
repository(name: $name, owner: $owner) {
|
||||
pullRequest(number: $number) {
|
||||
commits_with_authors: commits(first: 100, after: $cursor) {
|
||||
nodes {
|
||||
commit {
|
||||
author {
|
||||
user {
|
||||
login
|
||||
}
|
||||
email
|
||||
name
|
||||
}
|
||||
oid
|
||||
}
|
||||
}
|
||||
pageInfo {
|
||||
endCursor
|
||||
hasNextPage
|
||||
}
|
||||
...CommitAuthors
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
GH_GET_PR_PREV_REVIEWS_QUERY = """
|
||||
GH_GET_PR_PREV_REVIEWS_QUERY = GH_PR_REVIEWS_FRAGMENT + """
|
||||
query ($owner: String!, $name: String!, $number: Int!, $cursor: String!) {
|
||||
repository(name: $name, owner: $owner) {
|
||||
pullRequest(number: $number) {
|
||||
reviews(last: 100, before: $cursor) {
|
||||
nodes {
|
||||
author {
|
||||
login
|
||||
}
|
||||
state
|
||||
}
|
||||
pageInfo {
|
||||
startCursor
|
||||
hasPreviousPage
|
||||
}
|
||||
...PRReviews
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue