MCPcopy Create free account
hub / github.com/angular/dev-infra / getPrComments

Function getPrComments

ng-dev/utils/github.ts:178–242  ·  view source on GitHub ↗
(
  commentsSchema: PrCommentsSchema,
  prNumber: number,
  git: AuthenticatedGitClient,
)

Source from the content-addressed store, hash-verified

176
177/** Get all files in a PR from github */
178export async function getPrComments<PrCommentsSchema>(
179 commentsSchema: PrCommentsSchema,
180 prNumber: number,
181 git: AuthenticatedGitClient,
182) {
183 /** The owner and name of the repository */
184 const {owner, name} = git.remoteConfig;
185 /** The Graphql query object to get a page of pending PRs */
186 const PRS_QUERY = params(
187 {
188 $first: 'Int', // How many entries to get with each request
189 $after: 'String', // The cursor to start the page at
190 $owner: 'String!', // The organization to query for
191 $name: 'String!', // The repository to query for
192 },
193 {
194 repository: params(
195 {owner: '$owner', name: '$name'},
196 {
197 pullRequest: params(
198 {
199 number: prNumber,
200 },
201 {
202 comments: params(
203 {
204 first: '$first',
205 after: '$after',
206 },
207 {
208 nodes: [commentsSchema],
209 pageInfo: {
210 hasNextPage: types.boolean,
211 endCursor: types.string,
212 },
213 },
214 ),
215 },
216 ),
217 },
218 ),
219 },
220 );
221 /** The current cursor */
222 let cursor: string | undefined;
223 /** If an additional page of members is expected */
224 let hasNextPage = true;
225 /** Array of pending PRs */
226 const comments: Array<PrCommentsSchema> = [];
227
228 // For each page of the response, get the page and add it to the list of PRs
229 while (hasNextPage) {
230 const paramsValue = {
231 after: cursor || null,
232 first: 100,
233 owner,
234 name,
235 };

Callers 1

Calls 2

graphqlMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected