Open History to see the last commit
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 }
26}
27
28mutation AddReviewThreadReply($threadId: ID!, $body: String!) {
29 addPullRequestReviewThreadReply(input: { pullRequestReviewThreadId: $threadId, body: $body }) {
30 comment {
31 id
32 }
33 }
34}
35
36mutation AddReaction($subjectId: ID!, $content: ReactionContent!) {
37 addReaction(input: { subjectId: $subjectId, content: $content }) {
38 reaction {
39 content
40 }
41 }
42}
43
44mutation RemoveReaction($subjectId: ID!, $content: ReactionContent!) {
45 removeReaction(input: { subjectId: $subjectId, content: $content }) {
46 reaction {
47 content
48 }
49 }
50}
51
52mutation ResolveReviewThread($threadId: ID!) {
53 resolveReviewThread(input: { threadId: $threadId }) {
54 thread {
55 isResolved
56 }
57 }
58}
59
60mutation UnresolveReviewThread($threadId: ID!) {
61 unresolveReviewThread(input: { threadId: $threadId }) {
62 thread {
63 isResolved
64 }
65 }
66}
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 }
89}
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 }
98}
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 }
108}
109
110mutation UpdateReviewComment($commentId: ID!, $body: String!) {
111 updatePullRequestReviewComment(input: { pullRequestReviewCommentId: $commentId, body: $body }) {
112 pullRequestReviewComment {
113 id
114 }
115 }
116}
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 }
128}
129
130mutation MergePullRequest($input: MergePullRequestInput!) {
131 mergePullRequest(input: $input) {
132 pullRequest {
133 ...PullRequestActionSummary
134 }
135 }
136}
137
138mutation EnablePullRequestAutoMerge($input: EnablePullRequestAutoMergeInput!) {
139 enablePullRequestAutoMerge(input: $input) {
140 pullRequest {
141 ...PullRequestActionSummary
142 }
143 }
144}
145
146mutation DisablePullRequestAutoMerge($pullRequestId: ID!) {
147 disablePullRequestAutoMerge(input: { pullRequestId: $pullRequestId }) {
148 pullRequest {
149 ...PullRequestActionSummary
150 }
151 }
152}
153
154# Its own document: Enterprise Server rejects `includeStack` wherever it is named.
155mutation DisableStackAutoMerge($pullRequestId: ID!) {
156 disablePullRequestAutoMerge(input: { pullRequestId: $pullRequestId, includeStack: true }) {
157 pullRequest {
158 ...PullRequestActionSummary
159 }
160 }
161}
162
163mutation UpdatePullRequestBranch(
164 $pullRequestId: ID!
165 $expectedHeadOid: GitObjectID!
166 $updateMethod: PullRequestBranchUpdateMethod!
167) {
168 updatePullRequestBranch(
169 input: {
170 pullRequestId: $pullRequestId
171 expectedHeadOid: $expectedHeadOid
172 updateMethod: $updateMethod
173 }
174 ) {
175 pullRequest {
176 ...PullRequestActionSummary
177 }
178 }
179}
180
181mutation MarkPullRequestReadyForReview($pullRequestId: ID!) {
182 markPullRequestReadyForReview(input: { pullRequestId: $pullRequestId }) {
183 pullRequest {
184 ...PullRequestActionSummary
185 }
186 }
187}
188
189mutation ConvertPullRequestToDraft($pullRequestId: ID!) {
190 convertPullRequestToDraft(input: { pullRequestId: $pullRequestId }) {
191 pullRequest {
192 ...PullRequestActionSummary
193 }
194 }
195}
196
197mutation ClosePullRequest($pullRequestId: ID!) {
198 closePullRequest(input: { pullRequestId: $pullRequestId }) {
199 pullRequest {
200 ...PullRequestActionSummary
201 }
202 }
203}
204
205mutation ReopenPullRequest($pullRequestId: ID!) {
206 reopenPullRequest(input: { pullRequestId: $pullRequestId }) {
207 pullRequest {
208 ...PullRequestActionSummary
209 }
210 }
211}
212
213mutation AddComment($subjectId: ID!, $body: String!) {
214 addComment(input: { subjectId: $subjectId, body: $body }) {
215 clientMutationId
216 }
217}
218
219# Deletes a branch only while it still points at `beforeOid`, which `refUpdates` carries.
220mutation DeletePullRequestBranch($input: UpdateRefsInput!) {
221 updateRefs(input: $input) {
222 clientMutationId
223 }
224}