From 30035d37811080721cce2120936fb57af4b4be26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ari=20Perkki=C3=B6?= Date: Sun, 8 Aug 2021 19:46:59 +0300 Subject: [PATCH] feat: log repository count (#16) --- src/index.ts | 3 +++ test/index.test.ts | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/src/index.ts b/src/index.ts index a457755..2f4bbb4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -34,6 +34,9 @@ async function run() { // TODO: Handle cases where temp file doesn't exists, e.g. scan was erroneous fs.readFileSync(RESULTS_TMP, 'utf8') ); + + core.info(`Scanned ${testResults.repositoryCount} repositories`); + const results = testResults.results || []; if (results.length === 0) { diff --git a/test/index.test.ts b/test/index.test.ts index 106c717..c112871 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -48,6 +48,8 @@ async function runEntryPoint() { describe('entrypoint', () => { beforeEach(() => { mockCore.setFailed.mockClear(); + mockCore.info.mockClear(); + mockGithubClient.postResults.mockClear(); mockGithubClient.postResults.mockResolvedValue(undefined); }); @@ -101,6 +103,12 @@ describe('entrypoint', () => { expect(mockCore.setFailed).toHaveBeenCalledWith('Found 2 results'); }); + test('logs count of scanned repositories', async () => { + await runEntryPoint(); + + expect(mockCore.info).toHaveBeenCalledWith('Scanned 1502 repositories'); + }); + test('skips result posting when there are 0 results', async () => { mockFs.readFileSync.mockReturnValueOnce('[]'); await runEntryPoint();