Commit 8c3e426 1 parent 66cd16d commit 8c3e426 Copy full SHA for 8c3e426
File tree 3 files changed +22
-10
lines changed
3 files changed +22
-10
lines changed Original file line number Diff line number Diff line change 1
- import { getInput , setFailed } from "@actions/core" ;
1
+ import * as core from "@actions/core" ;
2
2
import { exec } from "@actions/exec" ;
3
+ import path from "path" ;
3
4
4
5
/**
5
6
* Converts the given VS Code theme to a Visual Studio theme.
6
7
* @param dir
7
8
*/
8
- export async function convertTheme ( dir : string ) : Promise < void > {
9
- const themeToConvert = getInput ( "path" ) ;
9
+ export async function convertTheme (
10
+ workDir : string ,
11
+ themePath : string ,
12
+ ) : Promise < void > {
13
+ const themeDir = path . resolve ( themePath ) ;
14
+ core . info ( `Converting theme ${ themeDir } ...` ) ;
10
15
11
16
try {
12
- exec ( `bin\Debug\net6.0\ThemeConverter.exe` , [ `-i ${ themeToConvert } ` ] ) ;
17
+ // ThemeConverter looks for some files in the same directory as the executable relatively,
18
+ // so we have to execute it there and not from the action root
19
+ process . chdir (
20
+ `${ core . toPlatformPath ( `${ workDir } /ThemeConverter/ThemeConverter/bin/Debug/net6.0` ) } ` ,
21
+ ) ;
22
+ await exec ( `./ThemeConverter -i ${ themeDir } ` ) ;
13
23
} catch ( error : any ) {
14
- setFailed ( `Action failed with error: "${ error . message } "` ) ;
24
+ core . setFailed ( `Action failed with error: "${ error . message } "` ) ;
15
25
}
16
26
}
Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ export async function run(): Promise<void> {
15
15
16
16
// Clone and build ThemeConverter program
17
17
await cloneRepository ( WORK_DIRECTORY ) ;
18
- await buildProject ( WORK_DIRECTORY ) ;
18
+ const projectDir = await buildProject ( WORK_DIRECTORY ) ;
19
+ if ( projectDir === undefined ) throw new Error ( ) ;
19
20
20
21
// Convert theme JSON
21
22
const path = core . getInput ( "path" ) ;
@@ -24,6 +25,6 @@ export async function run(): Promise<void> {
24
25
core . setOutput ( "output-vsix" , "" ) ;
25
26
} catch ( error ) {
26
27
// Fail the workflow run if an error occurs
27
- if ( error instanceof Error ) core . setFailed ( error . message ) ;
28
+ if ( error instanceof Error ) core . setFailed ( error ) ;
28
29
}
29
30
}
Original file line number Diff line number Diff line change 1
- import { exec , } from "@actions/exec" ;
1
+ import { exec } from "@actions/exec" ;
2
2
import { toPlatformPath , setFailed , info } from "@actions/core" ;
3
3
4
4
/**
@@ -28,8 +28,9 @@ export async function buildProject(buildDir: string): Promise<void> {
28
28
info ( `Building ThemeConverter project in "${ buildDir } "...` ) ;
29
29
30
30
try {
31
- process . chdir ( `${ toPlatformPath ( `${ buildDir } /ThemeConverter/ThemeConverter/` ) } ` ) ;
32
- await exec ( `dotnet build ThemeConverter.csproj` ) ;
31
+ await exec (
32
+ `dotnet build ${ toPlatformPath ( `${ buildDir } /ThemeConverter/ThemeConverter/ThemeConverter.csproj` ) } ` ,
33
+ ) ;
33
34
} catch ( error ) {
34
35
setFailed ( `Action failed with error: "${ ( error as Error ) . message } "` ) ;
35
36
}
You can’t perform that action at this time.
0 commit comments