diff --git a/.changeset/five-cameras-hammer.md b/.changeset/lucky-bats-reflect.md similarity index 60% rename from .changeset/five-cameras-hammer.md rename to .changeset/lucky-bats-reflect.md index 7e1cdda0c9..ad3171382e 100644 --- a/.changeset/five-cameras-hammer.md +++ b/.changeset/lucky-bats-reflect.md @@ -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. diff --git a/.changeset/short-schools-heal.md b/.changeset/short-schools-heal.md new file mode 100644 index 0000000000..3976ea3a0c --- /dev/null +++ b/.changeset/short-schools-heal.md @@ -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`. diff --git a/packages/integration/api-report.md b/packages/integration/api-report.md index ca24848db8..00623dc917 100644 --- a/packages/integration/api-report.md +++ b/packages/integration/api-report.md @@ -203,11 +203,6 @@ export interface GithubCredentialsProvider { getCredentials(opts: { url: string }): Promise; } -// @public -export type GithubCredentialsProviderFactory = ( - config: GitHubIntegrationConfig, -) => GithubCredentialsProvider; - // @public export type GithubCredentialType = 'app' | 'token'; @@ -432,7 +427,7 @@ export class SingleInstanceGithubCredentialsProvider implements GithubCredentialsProvider { // (undocumented) - static create: GithubCredentialsProviderFactory; + static create: (config: GitHubIntegrationConfig) => GithubCredentialsProvider; getCredentials(opts: { url: string }): Promise; } diff --git a/packages/integration/src/github/DefaultGithubCredentialsProvider.test.ts b/packages/integration/src/github/SingleInstanceGithubCredentialsProvider.test.ts similarity index 100% rename from packages/integration/src/github/DefaultGithubCredentialsProvider.test.ts rename to packages/integration/src/github/SingleInstanceGithubCredentialsProvider.test.ts diff --git a/packages/integration/src/github/SingleInstanceGithubCredentialsProvider.ts b/packages/integration/src/github/SingleInstanceGithubCredentialsProvider.ts index 5b6fa39e75..408c5b1348 100644 --- a/packages/integration/src/github/SingleInstanceGithubCredentialsProvider.ts +++ b/packages/integration/src/github/SingleInstanceGithubCredentialsProvider.ts @@ -22,7 +22,6 @@ import { DateTime } from 'luxon'; import { GithubCredentials, GithubCredentialsProvider, - GithubCredentialsProviderFactory, GithubCredentialType, } from './types'; @@ -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, diff --git a/packages/integration/src/github/index.ts b/packages/integration/src/github/index.ts index fa8dfb4b86..429a2b1c76 100644 --- a/packages/integration/src/github/index.ts +++ b/packages/integration/src/github/index.ts @@ -27,7 +27,6 @@ export { export type { GithubCredentials, GithubCredentialsProvider, - GithubCredentialsProviderFactory, GithubCredentialType, } from './types'; export { GitHubIntegration, replaceGitHubUrlType } from './GitHubIntegration'; diff --git a/packages/integration/src/github/types.ts b/packages/integration/src/github/types.ts index 48609d46f0..15f5375570 100644 --- a/packages/integration/src/github/types.ts +++ b/packages/integration/src/github/types.ts @@ -14,8 +14,6 @@ * limitations under the License. */ -import { GitHubIntegrationConfig } from './config'; - /** * The type of credentials produced by the credential provider. * @@ -43,13 +41,3 @@ export type GithubCredentials = { export interface GithubCredentialsProvider { getCredentials(opts: { url: string }): Promise; } - -/** - * This allows implementations to provide factories to create credential providers - * - * @public - * - */ -export type GithubCredentialsProviderFactory = ( - config: GitHubIntegrationConfig, -) => GithubCredentialsProvider;