From da75ca58fadd1ffcf5d76f9946c2fe9d28951a3c Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Thu, 9 Jul 2026 19:44:22 +0100 Subject: [PATCH] Add action vars helpers to `BaseEnvBuilder` --- src/testing-utils.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/testing-utils.ts b/src/testing-utils.ts index fab26d57b..b81b9b97b 100644 --- a/src/testing-utils.ts +++ b/src/testing-utils.ts @@ -269,6 +269,34 @@ abstract class BaseEnvBuilder< return result; } + /** + * Sets environment variables that are always available to GitHub Actions, + * excluding some that are expected to be set to paths. + * + * @param overrides Overrides for the defaults. + */ + public withDefaultActionsEnv(overrides?: ActionVarOverrides): this { + const result = this.clone(); + setupBaseActionsVars(overrides, result.state.env); + return result; + } + + /** + * Sets environment variables that are always available to GitHub Actions. + * @param tempDir A value for `RUNNER_TEMP` and `GITHUB_WORKSPACE`. + * @param toolsDir A value for `RUNNER_TOOL_CACHE`. + * @param overrides Overrides for the defaults. + */ + public withActionsEnv( + tempDir: string, + toolsDir: string, + overrides?: ActionVarOverrides, + ): this { + const result = this.clone(); + setupActionsVars(tempDir, toolsDir, overrides); + return result; + } + public withEnv(arg: ValueOrMutation): this { const result = this.clone(); if (typeof arg === "function") {