Skip to content

Commit bd9c662

Browse files
authored
Merge pull request #10 from frankgrimes97/fix/boolean-inputs
Fix parsing of GitHub Action boolean inputs
2 parents 3e7cd88 + 33b45d2 commit bd9c662

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

avrolint.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ let avrolint = function(avscFilePath, options={"undocumentedCheck": true, "compl
66
return new Promise((resolve) => {
77
// default, assume input is single file
88
var filePaths = [avscFilePath];
9-
try {
9+
try {
1010
// try to see if it's a list of paths in JSON array
1111
filePaths = JSON.parse(avscFilePath);
1212
}
1313
catch (err) {
14-
// ignore
14+
// ignore
1515
}
1616

1717
var filePathsWithErrors = new Set();
@@ -93,7 +93,7 @@ let isOrContainsRecord = function(field) {
9393
}
9494

9595
let isUnionType = function(type) {
96-
return Array.isArray(type);
96+
return Array.isArray(type);
9797
}
9898

9999
let getRecordSchema = function(field) {
@@ -136,7 +136,7 @@ let getUnionSchema = function(field) {
136136
if (upperCaseFieldType === "ARRAY" && isUnionType(field.type.items)) {
137137
return field.type.items;
138138
} else if (upperCaseFieldType === "MAP" && isUnionType(field.type.values)) {
139-
return field.type.values;
139+
return field.type.values;
140140
}
141141

142142
}

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ async function run() {
55
try {
66
// 'avsc-to-lint' input defined in action metadata file
77
const avscToLint = core.getInput('avsc-to-lint', {required: true});
8-
const undocumentedCheck = core.getInput(
8+
const undocumentedCheck = core.getBooleanInput(
99
'undocumented-field-check',
1010
{required: true}
1111
);
12-
const complexUnionCheck = core.getInput(
12+
const complexUnionCheck = core.getBooleanInput(
1313
'complex-union-check',
1414
{required: true}
1515
);
1616
console.log(`Linting ${avscToLint}!`);
1717
await avrolint(
1818
avscToLint,
19-
{
19+
{
2020
"undocumentedCheck": undocumentedCheck,
2121
"complexUnionCheck": complexUnionCheck
22-
}
22+
}
2323
);
2424
} catch (error) {
2525
console.error(error.stack);

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
"test": "jest",
66
"all": "npm run lint && npm run prepare && npm run test"
77
},
8+
"eslintConfig": {
9+
"extends": "eslint:recommended"
10+
},
811
"dependencies": {
912
"@actions/core": "^1.10.0",
1013
"avro-js": "^1.11.1"

0 commit comments

Comments
 (0)