diff --git a/__tests__/actionUtils.test.ts b/__tests__/actionUtils.test.ts index 269da8e..4ada017 100644 --- a/__tests__/actionUtils.test.ts +++ b/__tests__/actionUtils.test.ts @@ -207,11 +207,13 @@ test("getGCSBucket returns gcs-bucket input when provided", () => { try { testUtils.setInput("gcs-bucket", "input-bucket"); process.env["CULA_CACHE_GCS_BUCKET"] = "env-bucket"; + process.env["CONFIGURED_GCS_BUCKET"] = "configured-bucket"; expect(actionUtils.getGCSBucket()).toBe("input-bucket"); } finally { testUtils.clearInputs(); delete process.env["CULA_CACHE_GCS_BUCKET"]; + delete process.env["CONFIGURED_GCS_BUCKET"]; } }); @@ -225,15 +227,39 @@ test("getGCSBucket falls back to CULA_CACHE_GCS_BUCKET", () => { } }); +test("getGCSBucket falls back to CONFIGURED_GCS_BUCKET", () => { + try { + process.env["CONFIGURED_GCS_BUCKET"] = "configured-bucket"; + + expect(actionUtils.getGCSBucket()).toBe("configured-bucket"); + } finally { + delete process.env["CONFIGURED_GCS_BUCKET"]; + } +}); + +test("getGCSBucket prefers CULA_CACHE_GCS_BUCKET over CONFIGURED_GCS_BUCKET", () => { + try { + process.env["CULA_CACHE_GCS_BUCKET"] = "env-bucket"; + process.env["CONFIGURED_GCS_BUCKET"] = "configured-bucket"; + + expect(actionUtils.getGCSBucket()).toBe("env-bucket"); + } finally { + delete process.env["CULA_CACHE_GCS_BUCKET"]; + delete process.env["CONFIGURED_GCS_BUCKET"]; + } +}); + test("getGCSBucket returns empty string without input or environment variable", () => { try { testUtils.clearInputs(); delete process.env["CULA_CACHE_GCS_BUCKET"]; + delete process.env["CONFIGURED_GCS_BUCKET"]; expect(actionUtils.getGCSBucket()).toBe(""); } finally { testUtils.clearInputs(); delete process.env["CULA_CACHE_GCS_BUCKET"]; + delete process.env["CONFIGURED_GCS_BUCKET"]; } }); diff --git a/action.yml b/action.yml index 5378462..ce2dd79 100644 --- a/action.yml +++ b/action.yml @@ -27,7 +27,7 @@ inputs: default: 'false' required: false gcs-bucket: - description: 'Google Cloud Storage bucket name to use for caching. When provided, GCS will be used as the cache backend. Defaults to the CULA_CACHE_GCS_BUCKET environment variable when omitted.' + description: 'Google Cloud Storage bucket name to use for caching. When provided, GCS will be used as the cache backend. Defaults to the CULA_CACHE_GCS_BUCKET or CONFIGURED_GCS_BUCKET environment variable when omitted.' required: false gcs-path-prefix: description: 'Optional prefix path within the GCS bucket for cache files' diff --git a/dist/restore-only/index.js b/dist/restore-only/index.js index 83a37f4..3fb4e9b 100644 --- a/dist/restore-only/index.js +++ b/dist/restore-only/index.js @@ -78376,7 +78376,10 @@ function getInputAsBool(name, options) { return result.toLowerCase() === "true"; } function getGCSBucket() { - return core.getInput(constants_1.Inputs.GCSBucket) || process.env["CULA_CACHE_GCS_BUCKET"] || ""; + return (core.getInput(constants_1.Inputs.GCSBucket) || + process.env["CULA_CACHE_GCS_BUCKET"] || + process.env["CONFIGURED_GCS_BUCKET"] || + ""); } // Check if GCS is configured and available function isGCSAvailable() { diff --git a/dist/restore/index.js b/dist/restore/index.js index 37406ce..d436f8d 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -78376,7 +78376,10 @@ function getInputAsBool(name, options) { return result.toLowerCase() === "true"; } function getGCSBucket() { - return core.getInput(constants_1.Inputs.GCSBucket) || process.env["CULA_CACHE_GCS_BUCKET"] || ""; + return (core.getInput(constants_1.Inputs.GCSBucket) || + process.env["CULA_CACHE_GCS_BUCKET"] || + process.env["CONFIGURED_GCS_BUCKET"] || + ""); } // Check if GCS is configured and available function isGCSAvailable() { diff --git a/dist/save-only/index.js b/dist/save-only/index.js index 72e3ba2..e64bfb9 100644 --- a/dist/save-only/index.js +++ b/dist/save-only/index.js @@ -78389,7 +78389,10 @@ function getInputAsBool(name, options) { return result.toLowerCase() === "true"; } function getGCSBucket() { - return core.getInput(constants_1.Inputs.GCSBucket) || process.env["CULA_CACHE_GCS_BUCKET"] || ""; + return (core.getInput(constants_1.Inputs.GCSBucket) || + process.env["CULA_CACHE_GCS_BUCKET"] || + process.env["CONFIGURED_GCS_BUCKET"] || + ""); } // Check if GCS is configured and available function isGCSAvailable() { diff --git a/dist/save/index.js b/dist/save/index.js index cd40ceb..6237269 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -78389,7 +78389,10 @@ function getInputAsBool(name, options) { return result.toLowerCase() === "true"; } function getGCSBucket() { - return core.getInput(constants_1.Inputs.GCSBucket) || process.env["CULA_CACHE_GCS_BUCKET"] || ""; + return (core.getInput(constants_1.Inputs.GCSBucket) || + process.env["CULA_CACHE_GCS_BUCKET"] || + process.env["CONFIGURED_GCS_BUCKET"] || + ""); } // Check if GCS is configured and available function isGCSAvailable() { diff --git a/restore/action.yml b/restore/action.yml index 15ae1ab..1680734 100644 --- a/restore/action.yml +++ b/restore/action.yml @@ -24,7 +24,7 @@ inputs: default: 'false' required: false gcs-bucket: - description: 'Google Cloud Storage bucket name to use for caching. When provided, GCS will be used as the cache backend. Defaults to the CULA_CACHE_GCS_BUCKET environment variable when omitted.' + description: 'Google Cloud Storage bucket name to use for caching. When provided, GCS will be used as the cache backend. Defaults to the CULA_CACHE_GCS_BUCKET or CONFIGURED_GCS_BUCKET environment variable when omitted.' required: false gcs-path-prefix: description: 'Optional prefix path within the GCS bucket for cache files' diff --git a/save/action.yml b/save/action.yml index c450da8..4e2d098 100644 --- a/save/action.yml +++ b/save/action.yml @@ -16,7 +16,7 @@ inputs: default: 'false' required: false gcs-bucket: - description: 'Google Cloud Storage bucket name to use for caching. When provided, GCS will be used as the cache backend. Defaults to the CULA_CACHE_GCS_BUCKET environment variable when omitted.' + description: 'Google Cloud Storage bucket name to use for caching. When provided, GCS will be used as the cache backend. Defaults to the CULA_CACHE_GCS_BUCKET or CONFIGURED_GCS_BUCKET environment variable when omitted.' required: false gcs-path-prefix: description: 'Optional prefix path within the GCS bucket for cache files' diff --git a/src/utils/actionUtils.ts b/src/utils/actionUtils.ts index 3206b0e..7958c79 100644 --- a/src/utils/actionUtils.ts +++ b/src/utils/actionUtils.ts @@ -67,7 +67,12 @@ export function getInputAsBool( } export function getGCSBucket(): string { - return core.getInput(Inputs.GCSBucket) || process.env["CULA_CACHE_GCS_BUCKET"] || ""; + return ( + core.getInput(Inputs.GCSBucket) || + process.env["CULA_CACHE_GCS_BUCKET"] || + process.env["CONFIGURED_GCS_BUCKET"] || + "" + ); } // Check if GCS is configured and available