Skip to content

Commit f043f52

Browse files
committed
chore: minor tweaks and updates
1 parent aadc002 commit f043f52

File tree

5 files changed

+18
-16
lines changed

5 files changed

+18
-16
lines changed

__tests__/inputs.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ describe('parseChangeMapInput', () => {
1515
const changeMap = parseChangeMapInput([
1616
'python_files: {"globs": "*.py", "separateDeleted": true}',
1717
'requirements: {"globs": "requirements/*.txt"}',
18+
'tests: {"globs": ["tests/*", "__tests__/*"]}',
1819
]);
1920

2021
expect(changeMap).toEqual([
@@ -23,6 +24,10 @@ describe('parseChangeMapInput', () => {
2324
label: 'requirements',
2425
config: { globs: 'requirements/*.txt', separateDeleted: false },
2526
},
27+
{
28+
label: 'tests',
29+
config: { globs: ['tests/*', '__tests__/*'], separateDeleted: false },
30+
},
2631
]);
2732
});
2833
});

dist/index.js

Lines changed: 7 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ export async function run(): Promise<void> {
6565
core.setOutput(`any-matches`, anyFilesChanged);
6666
core.debug(`Finished ${new Date().toTimeString()}`);
6767
} catch (error: unknown) {
68-
if (error === null || (typeof error !== 'string' && typeof error !== 'object')) {
69-
core.setFailed('Unknown error encountered');
68+
if (error instanceof Error) {
69+
core.debug(`Stack trace: ${error.stack}`);
70+
core.setFailed(error);
7071
return;
7172
}
7273

@@ -75,11 +76,6 @@ export async function run(): Promise<void> {
7576
return;
7677
}
7778

78-
if ('message' in error && typeof error.message === 'string') {
79-
core.setFailed(error.message);
80-
return;
81-
}
82-
8379
core.setFailed('Unknown error encountered');
8480
}
8581
}

src/utils/inputs.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@ function parseLabelMapInput(changeMapInput: string[]): [string, string][] {
5454
}
5555

5656
export function parseChangeMapInput(changeMapInput: string[]): ChangeMap[] {
57+
core.debug(`ChangeMapInput: ${JSON.stringify(changeMapInput)}`);
5758
const labelMapTuples = parseLabelMapInput(changeMapInput);
5859
const changeMap: ChangeMap[] = [];
5960

6061
for (const [label, jsonMap] of labelMapTuples) {
62+
core.debug(`label=${label} jsonMap=${jsonMap}`);
6163
const parsedInput = JSON.parse(jsonMap) as unknown;
6264
const { globs, separateDeleted = false } = ChangeMapSchema.parse(parsedInput);
6365
changeMap.push({

0 commit comments

Comments
 (0)