Skip to content

Commit

Permalink
fix(ng-dev): use token to determine if the AuthenticatedGitClient has…
Browse files Browse the repository at this point in the history
… been configured (#773)

Previously we allowed for the AuthenticatedGitClient to be configured multiple times before
it `get` was called, however this is incorrect as only one configuration is to be allowed.

PR Close #773
  • Loading branch information
josephperrott committed Aug 17, 2022
1 parent 9a28358 commit 9323859
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/local-actions/changelog/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -68650,7 +68650,7 @@ Alternatively, a new token can be created at: ${GITHUB_TOKEN_GENERATE_URL}
return AuthenticatedGitClient._authenticatedInstance;
}
static configure(token, userType = "user") {
if (AuthenticatedGitClient._authenticatedInstance) {
if (AuthenticatedGitClient._token) {
throw Error("Unable to configure `AuthenticatedGitClient` as it has been configured already.");
}
AuthenticatedGitClient._token = token;
Expand Down
2 changes: 1 addition & 1 deletion github-actions/slash-commands/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -70023,7 +70023,7 @@ Alternatively, a new token can be created at: ${GITHUB_TOKEN_GENERATE_URL}
return AuthenticatedGitClient._authenticatedInstance;
}
static configure(token, userType = "user") {
if (AuthenticatedGitClient._authenticatedInstance) {
if (AuthenticatedGitClient._token) {
throw Error("Unable to configure `AuthenticatedGitClient` as it has been configured already.");
}
AuthenticatedGitClient._token = token;
Expand Down
2 changes: 1 addition & 1 deletion ng-dev/utils/git/authenticated-git-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export class AuthenticatedGitClient extends GitClient {

/** Configures an authenticated git client. */
static configure(token: string, userType: UserType = 'user'): void {
if (AuthenticatedGitClient._authenticatedInstance) {
if (AuthenticatedGitClient._token) {
throw Error(
'Unable to configure `AuthenticatedGitClient` as it has been configured already.',
);
Expand Down

0 comments on commit 9323859

Please sign in to comment.