From 41f70d21d75c1946bf5936b8e5ad748bdbdd3989 Mon Sep 17 00:00:00 2001 From: Tavi Nolan Date: Thu, 11 Apr 2024 11:15:39 +0100 Subject: [PATCH] reverting changes to github action Signed-off-by: Tavi Nolan --- .../src/actions/github.test.ts | 52 ------------------- .../src/actions/github.ts | 9 ---- 2 files changed, 61 deletions(-) diff --git a/plugins/scaffolder-backend-module-github/src/actions/github.test.ts b/plugins/scaffolder-backend-module-github/src/actions/github.test.ts index a346781428..73fa7fbcd0 100644 --- a/plugins/scaffolder-backend-module-github/src/actions/github.test.ts +++ b/plugins/scaffolder-backend-module-github/src/actions/github.test.ts @@ -2066,56 +2066,4 @@ describe('publish:github', () => { requiredCommitSigning: false, }); }); - - it('should not call createInOrg during dry run', async () => { - mockOctokit.rest.users.getByUsername.mockResolvedValue({ - data: { type: 'Organization' }, - }); - - mockOctokit.rest.teams.getByName.mockResolvedValue({ - data: { - name: 'blam', - id: 42, - }, - }); - - mockOctokit.rest.repos.createInOrg.mockResolvedValue({ data: {} }); - - mockContext.isDryRun = true; - await action.handler(mockContext); - expect(mockContext.output).toHaveBeenCalledWith('commitHash', 'commitHash'); - expect(mockContext.output).toHaveBeenCalledWith( - 'remoteUrl', - 'www.example.com', - ); - expect(mockContext.output).toHaveBeenCalledWith( - 'repoContentsUrl', - 'www.example.com/contents', - ); - expect(mockOctokit.rest.repos.createInOrg).not.toHaveBeenCalled(); - }); - - it('should not call createForAuthenticatedUser during dry run', async () => { - mockOctokit.rest.users.getByUsername.mockResolvedValue({ - data: { type: 'User' }, - }); - - mockOctokit.rest.repos.createForAuthenticatedUser.mockResolvedValue({ - data: {}, - }); - - await action.handler(mockContext); - expect(mockContext.output).toHaveBeenCalledWith('commitHash', 'commitHash'); - expect(mockContext.output).toHaveBeenCalledWith( - 'remoteUrl', - 'www.example.com', - ); - expect(mockContext.output).toHaveBeenCalledWith( - 'repoContentsUrl', - 'www.example.com/contents', - ); - expect( - mockOctokit.rest.repos.createForAuthenticatedUser, - ).not.toHaveBeenCalled(); - }); }); diff --git a/plugins/scaffolder-backend-module-github/src/actions/github.ts b/plugins/scaffolder-backend-module-github/src/actions/github.ts index ab7375daaa..63284002cc 100644 --- a/plugins/scaffolder-backend-module-github/src/actions/github.ts +++ b/plugins/scaffolder-backend-module-github/src/actions/github.ts @@ -229,15 +229,6 @@ export function createPublishGithubAction(options: { throw new InputError('Invalid repository owner provided in repoUrl'); } - if (ctx.isDryRun) { - ctx.logger.info(`Performing dry run of creating repository`); - ctx.output('commitHash', 'commitHash'); - ctx.output('remoteUrl', 'www.example.com'); - ctx.output('repoContentsUrl', 'www.example.com/contents'); - ctx.logger.info(`Dry run complete`); - return; - } - const newRepo = await createGithubRepoWithCollaboratorsAndTopics( client, repo,