Skip to content

Commit

Permalink
fix: fix input array parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
EndBug committed Mar 26, 2024
1 parent aef1d0d commit 47a4975
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/index.js

Large diffs are not rendered by default.

8 changes: 2 additions & 6 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,15 @@ export function parseInputArray(input: string): string[] {
core.debug(`Input parsed as JSON array of length ${json.length}`);
return json;
}
} catch {
return [];
}
} catch {} // eslint-disable-line no-empty

try {
const yaml = YAML.load(input);
if (yaml && Array.isArray(yaml) && yaml.every(e => typeof e === 'string')) {
core.debug(`Input parsed as YAML array of length ${yaml.length}`);
return yaml;
}
} catch {
return [];
}
} catch {} // eslint-disable-line no-empty

core.debug('Input parsed as single string');
return [input];
Expand Down

0 comments on commit 47a4975

Please sign in to comment.