Provide improved input handling
This commit is contained in:
parent
b5a9000c3f
commit
c16b76233e
6 changed files with 68 additions and 27 deletions
src
18
src/index.ts
18
src/index.ts
|
@ -1,3 +1,4 @@
|
|||
import { determineFlakeDirectories } from "./inputs.js";
|
||||
import { makeNixCommandArgs } from "./nix.js";
|
||||
import * as actionsCore from "@actions/core";
|
||||
import * as actionsExec from "@actions/exec";
|
||||
|
@ -11,6 +12,7 @@ class UpdateFlakeLockAction extends DetSysAction {
|
|||
private nixOptions: string[];
|
||||
private flakeInputs: string[];
|
||||
private pathToFlakeDir: string | null;
|
||||
private flakeDirs: string[] | null;
|
||||
|
||||
constructor() {
|
||||
super({
|
||||
|
@ -24,6 +26,13 @@ class UpdateFlakeLockAction extends DetSysAction {
|
|||
this.nixOptions = inputs.getArrayOfStrings("nix-options", "space");
|
||||
this.pathToFlakeDir = inputs.getStringOrNull("path-to-flake-dir");
|
||||
|
||||
const flakeDirsInput = inputs.getStringOrNull("flake-dirs");
|
||||
if (flakeDirsInput !== null) {
|
||||
this.flakeDirs = determineFlakeDirectories(flakeDirsInput);
|
||||
} else {
|
||||
this.flakeDirs = null;
|
||||
}
|
||||
|
||||
this.validateInputs();
|
||||
}
|
||||
|
||||
|
@ -34,15 +43,6 @@ class UpdateFlakeLockAction extends DetSysAction {
|
|||
// No post phase
|
||||
async post(): Promise<void> {}
|
||||
|
||||
private get flakeDirs(): string[] | null {
|
||||
const flakeDirs = inputs.getStringOrNull("flake-dirs");
|
||||
if (flakeDirs !== null) {
|
||||
return flakeDirs.trim().split(" ");
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async updateFlakeLock(): Promise<void> {
|
||||
if (this.flakeDirs !== null && this.flakeDirs.length > 0) {
|
||||
actionsCore.debug(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue