refactor(dev-infra): use shared github repo interface (#38656)
Instead of maintaining multiple interface for grouping owner name and repo name, we expose a shared interface describing a Github repository. One unfortunate downside is that the GraphQL Github and Rest API diverge slightly with the key for the repository name. i.e. rest uses `repo` for the name of a repository, while GraphQL uses `name` for the name. If that would be consistent, we could use the rest operator to pass a repository to the Octokit REST or GraphQL API. This does not work, so we have a small manual overhead as seen in the `branches.ts` file. PR Close #38656
This commit is contained in:

committed by
Alex Rickabaugh

parent
3a598cf5ed
commit
d7ff8d765c
@ -11,6 +11,14 @@ import * as Octokit from '@octokit/rest';
|
||||
import {RequestParameters} from '@octokit/types';
|
||||
import {query, types} from 'typed-graphqlify';
|
||||
|
||||
/** Interface describing a Github repository. */
|
||||
export interface GithubRepo {
|
||||
/** Owner login of the repository. */
|
||||
owner: string;
|
||||
/** Name of the repository. */
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** Error for failed Github API requests. */
|
||||
export class GithubApiRequestError extends Error {
|
||||
constructor(public status: number, message: string) {
|
||||
|
Reference in New Issue
Block a user