add working-directory option

This commit is contained in:
Adam Curtis 2023-01-31 17:25:10 -05:00
parent 88dc235639
commit e80cf306a4
5 changed files with 10162 additions and 15 deletions

View file

@ -28,6 +28,8 @@ inputs:
components:
description: Comma-separated list of components to be additionally installed for a new toolchain
required: false
working-directory:
description: Working directory to use for finding rust-toolchain
outputs:
rustc:

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

10165
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -35,6 +35,13 @@ function determineToolchain(overrideFile: string): string {
return rustToolchainFile;
}
export function setWorkingDirectory() {
const workingDirectory = input.getInput("working-directory");
if (workingDirectory) {
process.chdir(workingDirectory);
}
}
export function getToolchainArgs(overrideFile: string): ToolchainOptions {
let components: string[] | undefined = input.getInputList("components");
if (components && components.length === 0) {

View file

@ -6,6 +6,7 @@ import * as versions from "./versions";
import { RustUp, ToolchainOptions } from "@actions-rs/core";
async function run(): Promise<void> {
args.setWorkingDirectory();
// we use path.join to make sure this works on Windows, Linux and MacOS
const toolchainOverridePath = path.join(process.cwd(), "rust-toolchain");