Skip to content

Commit be09e31

Browse files
committed
Add env var alternative to dependency-caching input
1 parent c07c5b0 commit be09e31

File tree

6 files changed

+20
-4
lines changed

6 files changed

+20
-4
lines changed

lib/environment.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/environment.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/environment.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,11 @@ export enum EnvVar {
9898
* We check this later to ensure that it hasn't been tampered with by a late e.g. `setup-go` step.
9999
*/
100100
GO_BINARY_LOCATION = "CODEQL_ACTION_GO_BINARY",
101+
102+
/**
103+
* Used as an alternative to the `dependency-caching` input for the `init` Action.
104+
* Useful for experiments where it is easier to set an environment variable than
105+
* change the inputs to the Action.
106+
*/
107+
DEPENDENCY_CACHING = "CODEQL_ACTION_DEPENDENCY_CACHING",
101108
}

src/init-action.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,9 @@ async function logZstdAvailability(config: configUtils.Config, logger: Logger) {
708708
/** Determines whether dependency caching is enabled. */
709709
function getDependencyCachingEnabled(): boolean {
710710
// If the workflow specified something always respect that
711-
const dependencyCaching = getOptionalInput("dependency-caching");
711+
const dependencyCaching =
712+
getOptionalInput("dependency-caching") ||
713+
process.env[EnvVar.DEPENDENCY_CACHING];
712714
if (dependencyCaching !== undefined) return dependencyCaching === "true";
713715

714716
// On self-hosted runners which may have dependencies installed centrally, disable caching by default

0 commit comments

Comments
 (0)