Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/entry-points.js

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

2 changes: 1 addition & 1 deletion src/cli/output-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function resetCachedCodeQlVersion(): void {
* Returns the path to the temporary file that backs the
* on-disk cache of CLI responses between workflow steps.
*/
function getCommandCacheFilePath(env: Env): string {
export function getCommandCacheFilePath(env: Env): string {
return path.join(getTemporaryDirectory(env), COMMAND_CACHE_FILENAME);
}

Expand Down
13 changes: 13 additions & 0 deletions src/init-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
getTotalCacheSize,
shouldRestoreCache,
} from "./caching-utils";
import { getCommandCacheFilePath } from "./cli/output-cache";
import { CodeQL } from "./codeql";
import { getConfigFileInput } from "./config/file";
import { ComputedInput, getToolsInput } from "./config/inputs";
Expand Down Expand Up @@ -296,6 +297,18 @@ async function run(
);
}

// Delete the CLI output-cache file if it exists, to avoid
// accidentally reusing a stale version from a previous run.
try {
fs.unlinkSync(getCommandCacheFilePath(actionState.env));
Comment on lines +300 to +303

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is true.

} catch (e: any) {
if (e?.code !== "ENOENT") {
logger.warning(
`Cannot delete CLI-cache file ${getCommandCacheFilePath(actionState.env)}: ${e}`,
);
}
}

// Get the computed `tools` input.
toolsInput = await getToolsInput(
actionStateWithFeatures,
Expand Down
Loading