Skip to content

Commit

Permalink
addressing review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Fletcher <brian@roadie.io>
  • Loading branch information
punkle committed Dec 23, 2021
1 parent b5a69ef commit 7d4b4e9
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
'@backstage/backend-common': patch
'@backstage/integration': patch
'@backstage/plugin-catalog-backend': patch
'@backstage/plugin-catalog': patch
'@backstage/plugin-scaffolder-backend': patch
'@backstage/plugin-catalog-backend': patch
'@backstage/plugin-scaffolder': patch
'@backstage/plugin-scaffolder-backend': patch
---

Create an interface for the GitHub credentials provider in order to support providing implementations.
Uptake changes to the GitHub Credentials Provider interface.
13 changes: 13 additions & 0 deletions .changeset/short-schools-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@backstage/integration': minor
---

Create an interface for the GitHub credentials provider in order to support providing implementations.

We have changed the name of the `GithubCredentialsProvider` to `SingleInstanceGithubCredentialsProvider`.

`GithubCredentialsProvider` is now an interface that maybe implemented to provide a custom mechanism to retrieve GitHub credentials.

In a later release we will support configuring URL readers, scaffolder tasks, and processors with customer GitHub credentials providers.

If you want to uptake this release, you will need to replace all references to `GithubCredentialsProvider.create` with `SingleInstanceGithubCredentialsProvider.create`.
7 changes: 1 addition & 6 deletions packages/integration/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,6 @@ export interface GithubCredentialsProvider {
getCredentials(opts: { url: string }): Promise<GithubCredentials>;
}

// @public
export type GithubCredentialsProviderFactory = (
config: GitHubIntegrationConfig,
) => GithubCredentialsProvider;

// @public
export type GithubCredentialType = 'app' | 'token';

Expand Down Expand Up @@ -432,7 +427,7 @@ export class SingleInstanceGithubCredentialsProvider
implements GithubCredentialsProvider
{
// (undocumented)
static create: GithubCredentialsProviderFactory;
static create: (config: GitHubIntegrationConfig) => GithubCredentialsProvider;
getCredentials(opts: { url: string }): Promise<GithubCredentials>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { DateTime } from 'luxon';
import {
GithubCredentials,
GithubCredentialsProvider,
GithubCredentialsProviderFactory,
GithubCredentialType,
} from './types';

Expand Down Expand Up @@ -232,7 +231,9 @@ export class GithubAppCredentialsMux {
export class SingleInstanceGithubCredentialsProvider
implements GithubCredentialsProvider
{
static create: GithubCredentialsProviderFactory = config => {
static create: (
config: GitHubIntegrationConfig,
) => GithubCredentialsProvider = config => {
return new SingleInstanceGithubCredentialsProvider(
new GithubAppCredentialsMux(config),
config.token,
Expand Down
1 change: 0 additions & 1 deletion packages/integration/src/github/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export {
export type {
GithubCredentials,
GithubCredentialsProvider,
GithubCredentialsProviderFactory,
GithubCredentialType,
} from './types';
export { GitHubIntegration, replaceGitHubUrlType } from './GitHubIntegration';
12 changes: 0 additions & 12 deletions packages/integration/src/github/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
*/

import { GitHubIntegrationConfig } from './config';

/**
* The type of credentials produced by the credential provider.
*
Expand Down Expand Up @@ -43,13 +41,3 @@ export type GithubCredentials = {
export interface GithubCredentialsProvider {
getCredentials(opts: { url: string }): Promise<GithubCredentials>;
}

/**
* This allows implementations to provide factories to create credential providers
*
* @public
*
*/
export type GithubCredentialsProviderFactory = (
config: GitHubIntegrationConfig,
) => GithubCredentialsProvider;

0 comments on commit 7d4b4e9

Please sign in to comment.