modify change set to path, simplify to one expresion the check for config.token and config.apps and deconstructed the response fron the credentialProvider.getCredentials function
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-scaffolder-backend': minor
|
||||
'@backstage/plugin-scaffolder-backend': patch
|
||||
---
|
||||
|
||||
Added githubApp authentication to the scaffolder-backend plugin
|
||||
|
||||
@@ -31,10 +31,8 @@ export class GithubPublisher implements PublisherBase {
|
||||
config: GitHubIntegrationConfig,
|
||||
{ repoVisibility }: { repoVisibility: RepoVisibilityOptions },
|
||||
) {
|
||||
if (!config.token) {
|
||||
if (!config.apps) {
|
||||
return undefined;
|
||||
}
|
||||
if (!config.token && !config.apps) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const credentialsProvider = GithubCredentialsProvider.create(config);
|
||||
@@ -61,12 +59,13 @@ export class GithubPublisher implements PublisherBase {
|
||||
}: PublisherOptions): Promise<PublisherResult> {
|
||||
const { owner, name } = parseGitUrl(values.storePath);
|
||||
|
||||
const token =
|
||||
(
|
||||
await this.config.credentialsProvider.getCredentials({
|
||||
url: values.storePath,
|
||||
})
|
||||
).token || '';
|
||||
const { token } = await this.config.credentialsProvider.getCredentials({
|
||||
url: values.storePath,
|
||||
});
|
||||
|
||||
if (!token) {
|
||||
return { remoteUrl: '', catalogInfoUrl: undefined };
|
||||
}
|
||||
|
||||
const client = new Octokit({
|
||||
auth: token,
|
||||
|
||||
Reference in New Issue
Block a user