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) – A shell command template containing {0}, {1}, … placeholders.
args (string) – Replacement values; args[i] replaces {i}. Missing args produce an empty string.
- Returns:
string – The template with all placeholders substituted.
- 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 required for the temporary script file. Shells not listed here (e.g. bash, sh, zsh) do not require a specific extension, so they are omitted and the extension defaults to ‘’.
- 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.