Don't cd separately

This commit is contained in:
Graham Christensen 2024-05-06 16:13:34 -04:00
parent 21663d562d
commit 1752965d0b
3 changed files with 11 additions and 32 deletions

20
dist/index.js vendored
View file

@ -94310,26 +94310,16 @@ var UpdateFlakeLockAction = class {
this.pathToFlakeDir = inputs_exports.getStringOrNull("path-to-flake-dir");
}
async update() {
if (this.pathToFlakeDir !== null) {
const returnCode = await exec.exec("cd", [this.pathToFlakeDir]);
if (returnCode !== 0) {
this.idslib.recordEvent(EVENT_EXECUTION_FAILURE, {
returnCode
});
core.setFailed(
`Error when trying to cd into flake directory ${this.pathToFlakeDir}. Make sure the check that the directory exists.`
);
}
}
const nixCommandArgs = makeNixCommandArgs(
this.nixOptions,
this.flakeInputs,
this.commitMessage
);
const fullNixCommand = `nix ${nixCommandArgs.join(" ")}`;
core.debug(`running nix command:
${fullNixCommand}`);
const exitCode = await exec.exec("nix", nixCommandArgs);
const execOptions = {};
if (this.pathToFlakeDir !== null) {
execOptions.cwd = this.pathToFlakeDir;
}
const exitCode = await exec.exec("nix", nixCommandArgs, execOptions);
if (exitCode !== 0) {
this.idslib.recordEvent(EVENT_EXECUTION_FAILURE, {
exitCode