From 1cb1919f0c922d8d1e2675cb768fff16bfd1937a Mon Sep 17 00:00:00 2001 From: David Tuite Date: Tue, 15 Sep 2020 10:49:27 +0100 Subject: [PATCH] Send component description to GitHub We might as well set the description on the GitHub repo while we're creating it. --- .../src/scaffolder/stages/publish/github.test.ts | 2 ++ .../scaffolder-backend/src/scaffolder/stages/publish/github.ts | 3 +++ 2 files changed, 5 insertions(+) diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/publish/github.test.ts b/plugins/scaffolder-backend/src/scaffolder/stages/publish/github.test.ts index c06a553771..e68b0d0447 100644 --- a/plugins/scaffolder-backend/src/scaffolder/stages/publish/github.test.ts +++ b/plugins/scaffolder-backend/src/scaffolder/stages/publish/github.test.ts @@ -147,6 +147,7 @@ describe('GitHub Publisher', () => { storePath: 'blam/test', owner: 'bob', access: 'bob', + description: 'description', }, directory: '/tmp/test', }); @@ -154,6 +155,7 @@ describe('GitHub Publisher', () => { expect( mockGithubClient.repos.createForAuthenticatedUser, ).toHaveBeenCalledWith({ + description: 'description', name: 'test', private: false, }); diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/publish/github.ts b/plugins/scaffolder-backend/src/scaffolder/stages/publish/github.ts index 1d5c9e1947..d3aafb1e07 100644 --- a/plugins/scaffolder-backend/src/scaffolder/stages/publish/github.ts +++ b/plugins/scaffolder-backend/src/scaffolder/stages/publish/github.ts @@ -61,6 +61,7 @@ export class GithubPublisher implements PublisherBase { values: RequiredTemplateValues & Record, ) { const [owner, name] = values.storePath.split('/'); + const description = values.description as string; const user = await this.client.users.getByUsername({ username: owner }); @@ -71,10 +72,12 @@ export class GithubPublisher implements PublisherBase { org: owner, private: this.repoVisibility !== 'public', visibility: this.repoVisibility, + description, }) : this.client.repos.createForAuthenticatedUser({ name, private: this.repoVisibility === 'private', + description, }); const { data } = await repoCreationPromise;