Skip to content

Commit a05ace3

Browse files
committed
fix a small problem
1 parent 9524775 commit a05ace3

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

src/index.ts

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,26 @@ interface ChangesetsOutput {
55
version: string;
66
}
77

8-
const bumpedPackages: string[] = [];
9-
10-
const packages = () => {
8+
function main(): void {
119
try {
12-
return JSON.parse(core.getInput('bumped-packages', { required: true })) as ChangesetsOutput[]
10+
const input = core.getInput('bumped-packages', { required: true });
11+
const packages = JSON.parse(input) as ChangesetsOutput[];
12+
13+
const bumpedPackages: string[] = [];
14+
15+
for (const pkg of packages) {
16+
bumpedPackages.push(pkg.name);
17+
}
18+
19+
const output = bumpedPackages.join(',');
20+
core.setOutput("parsed-packages", output);
21+
22+
core.info('Parsed packages:\n\n- ' + bumpedPackages.join('\n- '));
23+
1324
} catch (error) {
14-
core.setFailed(error as Error)
15-
process.exit(256)
25+
core.setFailed(`Failed to parse bumped packages: ${error}`);
26+
process.exit(1);
1627
}
1728
}
1829

19-
for (const pkg of packages()) {
20-
bumpedPackages.push(pkg.name)
21-
}
22-
23-
core.setOutput("parsed-packages", bumpedPackages.join('\n'))
24-
25-
core.info('Written to output:\n\n- ' + bumpedPackages.join('\n- '))
30+
main();

0 commit comments

Comments
 (0)