lib.js

Utility functions and constants used by the os-specific-runner action.

Functions

formatShell(template, ...args)

Replaces {0}, {1}, … placeholders in a shell template with the provided args.

Arguments:
  • template (string)

  • args (string)

Returns:

string

getTempWorkingDir(working_directory)

Returns the absolute temp working directory for the given working_directory input. Uses os.tmpdir() so it works cross-platform (Linux, macOS, Windows).

  • When working_directory is an empty string, returns <tmpdir>/carlkidcrypto/os-specific-runner (the action’s own scratch space).

  • When working_directory is non-empty, returns <tmpdir>/<working_directory>, allowing callers to scope temp files to a named subdirectory.

Arguments:
  • working_directory (string) – The working_directory action input value.

Returns:

string – Absolute path to the temp working directory.

Constants

fileExtensions

type: Object.<string, string>

Maps shell name to the file extension used for the temporary script file.

builtInShells

type: Object.<string, string>

Maps built-in shell names to their command templates. The placeholder {0} is replaced with the path to the temporary script file.