mirror of
https://github.com/actions-rs/cargo.git
synced 2024-12-22 07:35:48 +02:00
Add working-directory
This commit is contained in:
parent
e8634b4139
commit
a527bf4d53
4 changed files with 11 additions and 1 deletions
|
@ -17,6 +17,9 @@ inputs:
|
|||
use-cross:
|
||||
description: Use cross instead of cargo
|
||||
default: false
|
||||
working-directory:
|
||||
description: Where to start the cargo process
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: 'node12'
|
||||
|
|
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
|
@ -10,6 +10,7 @@ import stringArgv from "string-argv";
|
|||
export interface Input {
|
||||
command: string;
|
||||
toolchain?: string;
|
||||
"working-directory"?: string;
|
||||
args: string[];
|
||||
useCross: boolean;
|
||||
}
|
||||
|
@ -22,11 +23,13 @@ export function get(): Input {
|
|||
toolchain = toolchain.slice(1);
|
||||
}
|
||||
const useCross = input.getInputBool("use-cross");
|
||||
const workingDir = input.getInput("working-directory");
|
||||
|
||||
return {
|
||||
command: command,
|
||||
args: args,
|
||||
useCross: useCross,
|
||||
toolchain: toolchain || undefined,
|
||||
"working-directory": workingDir || undefined
|
||||
};
|
||||
}
|
||||
|
|
|
@ -20,6 +20,10 @@ export async function run(actionInput: input.Input): Promise<void> {
|
|||
args.push(actionInput.command);
|
||||
args = args.concat(actionInput.args);
|
||||
|
||||
if (actionInput["working-directory"]) {
|
||||
process.chdir(path.join(process.cwd(), actionInput["working-directory"]))
|
||||
}
|
||||
|
||||
await program.call(args);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue