Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse sync-labels with getBooleanInput #674

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ const configureInput = (
mockInput: Partial<{
'repo-token': string;
'configuration-path': string;
'sync-labels': boolean;
dot: boolean;
'sync-labels': string;
dot: string;
'pr-number': string[];
}>
) => {
Expand All @@ -54,7 +54,7 @@ const configureInput = (
.mockImplementation((name: string, ...opts) => mockInput[name]);
jest
.spyOn(core, 'getBooleanInput')
.mockImplementation((name: string, ...opts) => mockInput[name]);
.mockImplementation((name: string, ...opts) => mockInput[name] == 'true');
};

afterAll(() => jest.restoreAllMocks());
Expand Down Expand Up @@ -91,7 +91,7 @@ describe('run', () => {
});

it('(with dot: true) adds labels to PRs that match our glob patterns', async () => {
configureInput({dot: true});
configureInput({dot: 'true'});
usingLabelerConfigYaml('only_pdfs.yml');
mockGitHubResponseChangedFiles('.foo.pdf');
getPullMock.mockResolvedValue(<any>{
Expand Down Expand Up @@ -137,7 +137,7 @@ describe('run', () => {
});

it('(with dot: true) does not add labels to PRs that do not match our glob patterns', async () => {
configureInput({dot: true});
configureInput({dot: 'true'});
usingLabelerConfigYaml('only_pdfs.yml');
mockGitHubResponseChangedFiles('foo.txt');

Expand All @@ -150,7 +150,7 @@ describe('run', () => {
configureInput({
'repo-token': 'foo',
'configuration-path': 'bar',
'sync-labels': true
'sync-labels': 'true'
});

usingLabelerConfigYaml('only_pdfs.yml');
Expand Down Expand Up @@ -178,7 +178,7 @@ describe('run', () => {
configureInput({
'repo-token': 'foo',
'configuration-path': 'bar',
'sync-labels': false
'sync-labels': 'false'
});

usingLabelerConfigYaml('only_pdfs.yml');
Expand All @@ -203,7 +203,7 @@ describe('run', () => {
configureInput({
'repo-token': 'foo',
'configuration-path': 'bar',
'sync-labels': false
'sync-labels': 'false'
});

usingLabelerConfigYaml('only_pdfs.yml');
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function run() {
try {
const token = core.getInput('repo-token');
const configPath = core.getInput('configuration-path', { required: true });
const syncLabels = !!core.getInput('sync-labels');
const syncLabels = core.getBooleanInput('sync-labels');
const dot = core.getBooleanInput('dot');
const prNumbers = getPrNumbers();
if (!prNumbers.length) {
Expand Down
2 changes: 1 addition & 1 deletion src/labeler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function run() {
try {
const token = core.getInput('repo-token');
const configPath = core.getInput('configuration-path', {required: true});
const syncLabels = !!core.getInput('sync-labels');
const syncLabels = core.getBooleanInput('sync-labels');
const dot = core.getBooleanInput('dot');

const prNumbers = getPrNumbers();
Expand Down