fix(dev-infra): github oauth token not picked up by Octokit (#42456)
We recently updated `@octokit/rest` to a more recent version. For this the Github client had to be refactored to account for new types of Octokit. With the refactorings the authentication of the Github client broke as we used an incorrect option for setting the OAuth token. The TS transpilation did not fail because the Octokit types support arbitrary options in the constructor. This is not solvable on our side, so we cannot prevent similar issues in the future unfortunately. Adding tests for authentication is not a reasonable option either.
This commit is contained in:
parent
7bd5ea4a7e
commit
3b434ed94d
|
@ -240,7 +240,7 @@ var GithubClient = /** @class */ (function () {
|
||||||
/** The graphql instance with authentication set during construction. */
|
/** The graphql instance with authentication set during construction. */
|
||||||
this._graphql = graphql.graphql.defaults({ headers: { authorization: "token " + this.token } });
|
this._graphql = graphql.graphql.defaults({ headers: { authorization: "token " + this.token } });
|
||||||
/** The Octokit instance actually performing API requests. */
|
/** The Octokit instance actually performing API requests. */
|
||||||
this._octokit = new rest.Octokit({ token: this.token });
|
this._octokit = new rest.Octokit({ auth: this.token });
|
||||||
this.pulls = this._octokit.pulls;
|
this.pulls = this._octokit.pulls;
|
||||||
this.repos = this._octokit.repos;
|
this.repos = this._octokit.repos;
|
||||||
this.issues = this._octokit.issues;
|
this.issues = this._octokit.issues;
|
||||||
|
|
|
@ -45,7 +45,7 @@ export class GithubClient {
|
||||||
/** The graphql instance with authentication set during construction. */
|
/** The graphql instance with authentication set during construction. */
|
||||||
private _graphql = graphql.defaults({headers: {authorization: `token ${this.token}`}});
|
private _graphql = graphql.defaults({headers: {authorization: `token ${this.token}`}});
|
||||||
/** The Octokit instance actually performing API requests. */
|
/** The Octokit instance actually performing API requests. */
|
||||||
private _octokit = new Octokit({token: this.token});
|
private _octokit = new Octokit({auth: this.token});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param token The github authentication token for Github Rest and Graphql API requests.
|
* @param token The github authentication token for Github Rest and Graphql API requests.
|
||||||
|
|
Loading…
Reference in New Issue