From 47d2ec78725341166b6b14cc7df3a15962702c41 Mon Sep 17 00:00:00 2001 From: MaksimZhukov <46996400+MaksimZhukov@users.noreply.github.com> Date: Thu, 11 May 2023 15:56:00 +0200 Subject: [PATCH] Revert "fix: correct reading of sync-labels input. (#480)" This reverts commit 751921c4436d6872c03199eee0edaa2ec83fb6b5. --- __tests__/main.test.ts | 14 ++------------ dist/index.js | 2 +- src/labeler.ts | 2 +- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 426b1e822..ab62eae37 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -51,17 +51,12 @@ describe('run', () => { const mockInput = { 'repo-token': 'foo', 'configuration-path': 'bar', - 'sync-labels': 'true' + 'sync-labels': true }; jest .spyOn(core, 'getInput') .mockImplementation((name: string, ...opts) => mockInput[name]); - jest - .spyOn(core, 'getBooleanInput') - .mockImplementation( - (name: string, ...opts) => mockInput[name] === 'true' - ); usingLabelerConfigYaml('only_pdfs.yml'); mockGitHubResponseChangedFiles('foo.txt'); @@ -87,17 +82,12 @@ describe('run', () => { const mockInput = { 'repo-token': 'foo', 'configuration-path': 'bar', - 'sync-labels': 'false' + 'sync-labels': false }; jest .spyOn(core, 'getInput') .mockImplementation((name: string, ...opts) => mockInput[name]); - jest - .spyOn(core, 'getBooleanInput') - .mockImplementation( - (name: string, ...opts) => mockInput[name] === 'true' - ); usingLabelerConfigYaml('only_pdfs.yml'); mockGitHubResponseChangedFiles('foo.txt'); diff --git a/dist/index.js b/dist/index.js index 6d753d52f..b3d5dbf2a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -49,7 +49,7 @@ function run() { try { const token = core.getInput('repo-token'); const configPath = core.getInput('configuration-path', { required: true }); - const syncLabels = core.getBooleanInput('sync-labels'); + const syncLabels = !!core.getInput('sync-labels', { required: false }); const prNumber = getPrNumber(); if (!prNumber) { core.info('Could not get pull request number from context, exiting'); diff --git a/src/labeler.ts b/src/labeler.ts index 96e152bc3..dd89044f5 100644 --- a/src/labeler.ts +++ b/src/labeler.ts @@ -15,7 +15,7 @@ export async function run() { try { const token = core.getInput('repo-token'); const configPath = core.getInput('configuration-path', {required: true}); - const syncLabels = core.getBooleanInput('sync-labels'); + const syncLabels = !!core.getInput('sync-labels', {required: false}); const prNumber = getPrNumber(); if (!prNumber) {