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

Method retrieveData

ng-dev/caretaker/check/github.ts:52–79  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50
51export class GithubQueriesModule extends BaseModule<GithubQueryResults | void> {
52 override async retrieveData() {
53 // Non-null assertion is used here as the check for undefined immediately follows to confirm the
54 // assertion. Typescript's type filtering does not seem to work as needed to understand
55 // whether githubQueries is undefined or not.
56 let queries = this.config.caretaker?.githubQueries!;
57 if (queries === undefined || queries.length === 0) {
58 Log.debug('No github queries defined in the configuration, skipping');
59 return;
60 }
61
62 /** The results of the generated github query. */
63 const queryResult = await this.git.github.graphql(this.buildGraphqlQuery(queries));
64 const results = Object.values(queryResult);
65
66 const {owner, name: repo} = this.git.remoteConfig;
67
68 return results.map((result, i) => {
69 const query = queries[i];
70 const queryURLParam = encodeURIComponent(query.query);
71
72 return {
73 queryName: query.name,
74 count: result.issueCount,
75 queryUrl: `https://github.com/${owner}/${repo}/issues?q=${queryURLParam}`,
76 matchedUrls: result.nodes.map((node) => node.url),
77 };
78 });
79 }
80
81 /** Build a Graphql query statement for the provided queries. */
82 private buildGraphqlQuery(queries: NonNullable<CaretakerConfig['githubQueries']>) {

Callers

nothing calls this directly

Calls 2

buildGraphqlQueryMethod · 0.95
graphqlMethod · 0.80

Tested by

no test coverage detected