Skip to content

Commit 8ed7d47

Browse files
committed
simply re-throw errors up to main
1 parent 8c3e426 commit 8ed7d47

File tree

4 files changed

+89
-12
lines changed

4 files changed

+89
-12
lines changed

dist/index.js

+78-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as core from "@actions/core";
2-
import { cloneRepository, buildProject } from "./themeConverter";
32
import { dependencyChecks } from "./checks";
3+
import { convertTheme } from "./converter";
4+
import { buildProject, cloneRepository } from "./themeConverter";
45

56
const WORK_DIRECTORY = "work";
67

@@ -19,12 +20,15 @@ export async function run(): Promise<void> {
1920
if (projectDir === undefined) throw new Error();
2021

2122
// Convert theme JSON
22-
const path = core.getInput("path");
23+
// await convertTheme(projectDir, core.getInput("themePath"));
24+
await convertTheme(WORK_DIRECTORY, "theme.json");
2325

2426
// Set outputs for other workflow steps to use
2527
core.setOutput("output-vsix", "");
2628
} catch (error) {
2729
// Fail the workflow run if an error occurs
28-
if (error instanceof Error) core.setFailed(error);
30+
core.setFailed(
31+
`Action failed with error: "${(error as Error).message}"`,
32+
);
2933
}
3034
}

src/themeConverter.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { info, toPlatformPath } from "@actions/core";
12
import { exec } from "@actions/exec";
2-
import { toPlatformPath, setFailed, info } from "@actions/core";
33

44
/**
55
* Clones the ThemeConverter project.
@@ -15,7 +15,7 @@ export async function cloneRepository(cloneDir: string): Promise<void> {
1515
cloneDir,
1616
]);
1717
} catch (error) {
18-
setFailed(`Action failed with error: "${(error as Error).message}"`);
18+
throw error;
1919
}
2020
}
2121

@@ -32,6 +32,6 @@ export async function buildProject(buildDir: string): Promise<void> {
3232
`dotnet build ${toPlatformPath(`${buildDir}/ThemeConverter/ThemeConverter/ThemeConverter.csproj`)}`,
3333
);
3434
} catch (error) {
35-
setFailed(`Action failed with error: "${(error as Error).message}"`);
35+
throw error;
3636
}
3737
}

0 commit comments

Comments
 (0)