Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #385 from github/allow-override-temp
Allow overriding path of temporary files.
Chris Gavin authored and GitHub committed Feb 15, 2021

Unverified

No user is associated with the committer email.
2 parents 3568e4a + 04d2b00 commit 49cb962
Showing 12 changed files with 26 additions and 15 deletions.
7 changes: 7 additions & 0 deletions lib/actions-util.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/actions-util.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/analyze-action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/analyze-action.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/autobuild-action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/autobuild-action.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/init-action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/init-action.js.map
7 changes: 7 additions & 0 deletions src/actions-util.ts
@@ -45,6 +45,13 @@ export function getRequiredEnvParam(paramName: string): string {
return value;
}

export function getTemporaryDirectory(): string {
const value = process.env["CODEQL_ACTION_TEMP"];
return value !== undefined && value !== ""
? value
: getRequiredEnvParam("RUNNER_TEMP");
}

/**
* Ensures all required environment variables are set in the context of a local run.
*/
5 changes: 1 addition & 4 deletions src/analyze-action.ts
@@ -63,10 +63,7 @@ async function run() {
return;
}
const logger = getActionsLogger();
config = await getConfig(
actionsUtil.getRequiredEnvParam("RUNNER_TEMP"),
logger
);
config = await getConfig(actionsUtil.getTemporaryDirectory(), logger);
if (config === undefined) {
throw new Error(
"Config file could not be found at expected location. Has the 'init' action been called?"
2 changes: 1 addition & 1 deletion src/autobuild-action.ts
@@ -57,7 +57,7 @@ async function run() {
}

const config = await config_utils.getConfig(
actionsUtil.getRequiredEnvParam("RUNNER_TEMP"),
actionsUtil.getTemporaryDirectory(),
logger
);
if (config === undefined) {
4 changes: 2 additions & 2 deletions src/init-action.ts
@@ -126,7 +126,7 @@ async function run() {
const initCodeQLResult = await initCodeQL(
actionsUtil.getOptionalInput("tools"),
apiDetails,
actionsUtil.getRequiredEnvParam("RUNNER_TEMP"),
actionsUtil.getTemporaryDirectory(),
actionsUtil.getRequiredEnvParam("RUNNER_TOOL_CACHE"),
"actions",
logger
@@ -139,7 +139,7 @@ async function run() {
actionsUtil.getOptionalInput("queries"),
actionsUtil.getOptionalInput("config-file"),
parseRepositoryNwo(actionsUtil.getRequiredEnvParam("GITHUB_REPOSITORY")),
actionsUtil.getRequiredEnvParam("RUNNER_TEMP"),
actionsUtil.getTemporaryDirectory(),
actionsUtil.getRequiredEnvParam("RUNNER_TOOL_CACHE"),
codeql,
actionsUtil.getRequiredEnvParam("GITHUB_WORKSPACE"),

0 comments on commit 49cb962

Please sign in to comment.