Skip to content

Commit 4f05277

Browse files
authored
Merge pull request #574 from MaksimZhukov/v5.0.0-beta.1
fix: correct reading of sync-labels input
2 parents e1fcf6f + 26342ba commit 4f05277

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

__tests__/main.test.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,17 @@ describe('run', () => {
6262
const mockInput = {
6363
'repo-token': 'foo',
6464
'configuration-path': 'bar',
65-
'sync-labels': true
65+
'sync-labels': 'true'
6666
};
6767

6868
jest
6969
.spyOn(core, 'getInput')
7070
.mockImplementation((name: string, ...opts) => mockInput[name]);
71+
jest
72+
.spyOn(core, 'getBooleanInput')
73+
.mockImplementation(
74+
(name: string, ...opts) => mockInput[name] === 'true'
75+
);
7176

7277
usingLabelerConfigYaml('only_pdfs.yml');
7378
mockGitHubResponseChangedFiles('foo.txt');
@@ -93,12 +98,17 @@ describe('run', () => {
9398
const mockInput = {
9499
'repo-token': 'foo',
95100
'configuration-path': 'bar',
96-
'sync-labels': false
101+
'sync-labels': 'false'
97102
};
98103

99104
jest
100105
.spyOn(core, 'getInput')
101106
.mockImplementation((name: string, ...opts) => mockInput[name]);
107+
jest
108+
.spyOn(core, 'getBooleanInput')
109+
.mockImplementation(
110+
(name: string, ...opts) => mockInput[name] === 'true'
111+
);
102112

103113
usingLabelerConfigYaml('only_pdfs.yml');
104114
mockGitHubResponseChangedFiles('foo.txt');

dist/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ function run() {
288288
try {
289289
const token = core.getInput('repo-token');
290290
const configPath = core.getInput('configuration-path', { required: true });
291-
const syncLabels = !!core.getInput('sync-labels', { required: false });
291+
const syncLabels = core.getBooleanInput('sync-labels');
292292
const prNumber = getPrNumber();
293293
if (!prNumber) {
294294
core.info('Could not get pull request number from context, exiting');

src/labeler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export async function run() {
3131
try {
3232
const token = core.getInput('repo-token');
3333
const configPath = core.getInput('configuration-path', {required: true});
34-
const syncLabels = !!core.getInput('sync-labels', {required: false});
34+
const syncLabels = core.getBooleanInput('sync-labels');
3535

3636
const prNumber = getPrNumber();
3737
if (!prNumber) {

0 commit comments

Comments
 (0)