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

Function getPrFiles

ng-dev/utils/github.ts:111–175  ·  view source on GitHub ↗
(
  fileSchema: PrFileSchema,
  prNumber: number,
  git: AuthenticatedGitClient,
)

Source from the content-addressed store, hash-verified

109
110/** Get all files in a PR from github */
111export async function getPrFiles<PrFileSchema>(
112 fileSchema: PrFileSchema,
113 prNumber: number,
114 git: AuthenticatedGitClient,
115) {
116 /** The owner and name of the repository */
117 const {owner, name} = git.remoteConfig;
118 /** The Graphql query object to get a page of pending PRs */
119 const PRS_QUERY = params(
120 {
121 $first: 'Int', // How many entries to get with each request
122 $after: 'String', // The cursor to start the page at
123 $owner: 'String!', // The organization to query for
124 $name: 'String!', // The repository to query for
125 },
126 {
127 repository: params(
128 {owner: '$owner', name: '$name'},
129 {
130 pullRequest: params(
131 {
132 number: prNumber,
133 },
134 {
135 files: params(
136 {
137 first: '$first',
138 after: '$after',
139 },
140 {
141 nodes: [fileSchema],
142 pageInfo: {
143 hasNextPage: types.boolean,
144 endCursor: types.string,
145 },
146 },
147 ),
148 },
149 ),
150 },
151 ),
152 },
153 );
154 /** The current cursor */
155 let cursor: string | undefined;
156 /** If an additional page of members is expected */
157 let hasNextPage = true;
158 /** Array of pending PRs */
159 const files: Array<PrFileSchema> = [];
160
161 // For each page of the response, get the page and add it to the list of PRs
162 while (hasNextPage) {
163 const paramsValue = {
164 after: cursor || null,
165 first: 100,
166 owner,
167 name,
168 };

Callers 1

Calls 2

graphqlMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected