refactor(dev-infra): update octokit to latest version v18 (#42666)
We previously held off with updating Octokit to v18 due to their more noticable issues with typings. This commit updates us to the latest version in order to take advantage of the new pagination API (which is also strongly-typed), and to not fall behind too much over time (Octokit seems to change quite often..) We work around the problem with the types for `getContent` by just using a type cast with a TODO (and link to the issue). Similarly we work around a problem where the Octokit types have an incorrect type for the name of the labels array in an API response. PR Close #42666
This commit is contained in:
committed by
Jessica Janiuk
parent
02742552f3
commit
279e63f65f
@@ -6,7 +6,10 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {OctokitOptions} from '@octokit/core/dist-types/types';
|
||||
import {graphql} from '@octokit/graphql';
|
||||
import {PaginateInterface} from '@octokit/plugin-paginate-rest';
|
||||
import {RestEndpointMethods} from '@octokit/plugin-rest-endpoint-methods/dist-types/generated/method-types';
|
||||
import {Octokit} from '@octokit/rest';
|
||||
import {RequestParameters} from '@octokit/types';
|
||||
import {query} from 'typed-graphqlify';
|
||||
@@ -41,10 +44,14 @@ export class GithubClient {
|
||||
readonly repos = this._octokit.repos;
|
||||
readonly issues = this._octokit.issues;
|
||||
readonly git = this._octokit.git;
|
||||
readonly paginate = this._octokit.paginate;
|
||||
readonly rateLimit = this._octokit.rateLimit;
|
||||
|
||||
constructor(private _octokitOptions?: Octokit.Options) {}
|
||||
// Note: These are properties from `Octokit` that are brought in by optional plugins.
|
||||
// TypeScript requires us to provide an explicit type for these.
|
||||
readonly rest: RestEndpointMethods = this._octokit.rest;
|
||||
readonly paginate: PaginateInterface = this._octokit.paginate;
|
||||
|
||||
constructor(private _octokitOptions?: OctokitOptions) {}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user