wip: hash bundle url and use it as the cache version
This commit is contained in:
parent
6de3e1cde4
commit
fff3de9938
3 changed files with 11 additions and 7 deletions
8
lib/setup-tools.js
generated
8
lib/setup-tools.js
generated
|
|
@ -10,6 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
const core = __importStar(require("@actions/core"));
|
||||
const toolcache = __importStar(require("@actions/tool-cache"));
|
||||
const path = __importStar(require("path"));
|
||||
const crypto = __importStar(require("crypto"));
|
||||
class CodeQLSetup {
|
||||
constructor(codeqlDist) {
|
||||
this.dist = codeqlDist;
|
||||
|
|
@ -35,17 +36,18 @@ class CodeQLSetup {
|
|||
}
|
||||
exports.CodeQLSetup = CodeQLSetup;
|
||||
async function setupCodeQL() {
|
||||
const version = '1.0.0';
|
||||
const hash = crypto.createHash('sha256');
|
||||
const codeqlURL = core.getInput('tools', { required: true });
|
||||
const codeqlURLHash = hash.update(codeqlURL).digest('hex');
|
||||
try {
|
||||
let codeqlFolder = toolcache.find('CodeQL', version);
|
||||
let codeqlFolder = toolcache.find('CodeQL', codeqlURLHash);
|
||||
if (codeqlFolder) {
|
||||
core.debug(`CodeQL found in cache ${codeqlFolder}`);
|
||||
}
|
||||
else {
|
||||
const codeqlPath = await toolcache.downloadTool(codeqlURL);
|
||||
const codeqlExtracted = await toolcache.extractTar(codeqlPath);
|
||||
codeqlFolder = await toolcache.cacheDir(codeqlExtracted, 'CodeQL', version);
|
||||
codeqlFolder = await toolcache.cacheDir(codeqlExtracted, 'CodeQL', codeqlURLHash);
|
||||
}
|
||||
return new CodeQLSetup(path.join(codeqlFolder, 'codeql'));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue