Skip to content
Source
Sign inSign up
Open History to see the last commit

pullRequestMutations.graphql

215 lines5.2 KB

1# Writes to a pull request and the remarks on it. Only pull request actions read their answer back,
2# so clients can show the result without another read.
3​
4fragment PullRequestActionSummary on PullRequest {
5 number
6 title
7 url
8 headRefName
9 baseRefName
10 state
11 isDraft
12 updatedAt
13 mergedAt
14 closedAt
15 headRefOid
16 author {
17 login
18 avatarUrl
19 ... on User {
20 name
21 }
22 }
23 autoMergeRequest {
24 mergeMethod
25 }
27​
28mutation AddReviewThreadReply($threadId: ID!, $body: String!) {
29 addPullRequestReviewThreadReply(input: { pullRequestReviewThreadId: $threadId, body: $body }) {
30 comment {
31 id
32 }
33 }
35​
36mutation AddReaction($subjectId: ID!, $content: ReactionContent!) {
37 addReaction(input: { subjectId: $subjectId, content: $content }) {
38 reaction {
39 content
40 }
41 }
43​
44mutation RemoveReaction($subjectId: ID!, $content: ReactionContent!) {
45 removeReaction(input: { subjectId: $subjectId, content: $content }) {
46 reaction {
47 content
48 }
49 }
51​
52mutation ResolveReviewThread($threadId: ID!) {
53 resolveReviewThread(input: { threadId: $threadId }) {
54 thread {
55 isResolved
56 }
57 }
59​
60mutation UnresolveReviewThread($threadId: ID!) {
61 unresolveReviewThread(input: { threadId: $threadId }) {
62 thread {
63 isResolved
64 }
65 }
67​
68# Rewrites the pull request's own words or its maintainer-edit setting. Every field is nullable so
69# that one document serves any combination: a variable the request does not send puts no entry in
70# the input at all, which leaves that field as it was rather than clearing it.
71mutation UpdatePullRequest(
72 $pullRequestId: ID!
73 $title: String
74 $body: String
75 $maintainerCanModify: Boolean
76) {
77 updatePullRequest(
78 input: {
79 pullRequestId: $pullRequestId
80 title: $title
81 body: $body
82 maintainerCanModify: $maintainerCanModify
83 }
84 ) {
85 pullRequest {
86 id
87 }
88 }
90​
91# Creates a new pull request that reverses a merged pull request.
92mutation RevertPullRequest($pullRequestId: ID!) {
93 revertPullRequest(input: { pullRequestId: $pullRequestId }) {
94 revertPullRequest {
95 id
96 }
97 }
99​
100# The two comment mutations name their comment differently; the variable is spelled the same in
101# both, so a rewrite sends one set of variables whichever kind of remark it is.
102mutation UpdateIssueComment($commentId: ID!, $body: String!) {
103 updateIssueComment(input: { id: $commentId, body: $body }) {
104 issueComment {
105 id
106 }
107 }
109​
110mutation UpdateReviewComment($commentId: ID!, $body: String!) {
111 updatePullRequestReviewComment(input: { pullRequestReviewCommentId: $commentId, body: $body }) {
112 pullRequestReviewComment {
113 id
114 }
115 }
117​
118# Clears one file, or puts it back. GitHub has no bulk form of either mutation, so
119# `GraphQLResolver.aliased` repeats this under an alias per file and a burst of ticks is one
120# request; `$viewed` picks which of the two each alias runs.
121mutation SetFileViewed($pullRequestId: ID!, $path: String!, $viewed: Boolean!) {
122 markFileAsViewed(input: { pullRequestId: $pullRequestId, path: $path }) @include(if: $viewed) {
123 clientMutationId
124 }
125 unmarkFileAsViewed(input: { pullRequestId: $pullRequestId, path: $path }) @skip(if: $viewed) {
126 clientMutationId
127 }
129​
130mutation MergePullRequest($input: MergePullRequestInput!) {
131 mergePullRequest(input: $input) {
132 pullRequest {
133 ...PullRequestActionSummary
134 }
135 }
137​
138mutation EnablePullRequestAutoMerge($input: EnablePullRequestAutoMergeInput!) {
139 enablePullRequestAutoMerge(input: $input) {
140 pullRequest {
141 ...PullRequestActionSummary
142 }
143 }
145​
146mutation DisablePullRequestAutoMerge($pullRequestId: ID!) {
147 disablePullRequestAutoMerge(input: { pullRequestId: $pullRequestId }) {
148 pullRequest {
149 ...PullRequestActionSummary
150 }
151 }
153​
154mutation UpdatePullRequestBranch(
155 $pullRequestId: ID!
156 $expectedHeadOid: GitObjectID!
157 $updateMethod: PullRequestBranchUpdateMethod!
158) {
159 updatePullRequestBranch(
160 input: {
161 pullRequestId: $pullRequestId
162 expectedHeadOid: $expectedHeadOid
163 updateMethod: $updateMethod
164 }
165 ) {
166 pullRequest {
167 ...PullRequestActionSummary
168 }
169 }
171​
172mutation MarkPullRequestReadyForReview($pullRequestId: ID!) {
173 markPullRequestReadyForReview(input: { pullRequestId: $pullRequestId }) {
174 pullRequest {
175 ...PullRequestActionSummary
176 }
177 }
179​
180mutation ConvertPullRequestToDraft($pullRequestId: ID!) {
181 convertPullRequestToDraft(input: { pullRequestId: $pullRequestId }) {
182 pullRequest {
183 ...PullRequestActionSummary
184 }
185 }
187​
188mutation ClosePullRequest($pullRequestId: ID!) {
189 closePullRequest(input: { pullRequestId: $pullRequestId }) {
190 pullRequest {
191 ...PullRequestActionSummary
192 }
193 }
195​
196mutation ReopenPullRequest($pullRequestId: ID!) {
197 reopenPullRequest(input: { pullRequestId: $pullRequestId }) {
198 pullRequest {
199 ...PullRequestActionSummary
200 }
201 }
203​
204mutation AddComment($subjectId: ID!, $body: String!) {
205 addComment(input: { subjectId: $subjectId, body: $body }) {
206 clientMutationId
207 }
209​
210# Deletes a branch only while it still points at `beforeOid`, which `refUpdates` carries.
211mutation DeletePullRequestBranch($input: UpdateRefsInput!) {
212 updateRefs(input: $input) {
213 clientMutationId
214 }