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:
ebarrios
2021-02-16 12:58:15 +01:00
parent edbc27bfdc
commit 3fc738a55c
2 changed files with 10 additions and 11 deletions
+1 -1
View File
@@ -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,