message: switch to semver instead of hash
diff: import * as core from '@actions/core';
  import * as toolcache from '@actions/tool-cache';
  -import * as crypto from 'crypto';
  +import * as semver from 'semver';
  import * as path from 'path';
  export class CodeQLSetup {
  @@ -30,18 +30,17 @@ export class CodeQLSetup {
  }
  export async function setupCodeQL(): Promise<CodeQLSetup> {
  - const hash = crypto.createHash('sha256');
  + try {
  const codeqlURL = core.getInput('tools', { required: true });
  - const codeqlURLHash = hash.update(codeqlURL).digest('hex');
  + const codeqlURLVersion = getCodeQLURLVersion(codeqlURL);
  - try {
  - let codeqlFolder = toolcache.find('CodeQL', codeqlURLHash);
  + let codeqlFolder = toolcache.find('CodeQL', codeqlURLVersion);
  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', codeqlURLHash);
  + codeqlFolder = await toolcache.cacheDir(codeqlExtracted, 'CodeQL', codeqlURLVersion);
  }
  return new CodeQLSetup(path.join(codeqlFolder, 'codeql'));
  @@ -50,3 +49,25 @@ export async function setupCodeQL(): Promise<CodeQLSetup> {
  throw new Error("Unable to download and extract CodeQL CLI");
  }
  }
  +
  +export function getCodeQLURLVersion(url: string): string {
  +
  + const match = url.match(/codeql-bundle-([\d+(\.\d+)]+)/);
  + if (match === null || match.length < 2) {
  + throw new Error(`Malformed tools url: ${url}. Version could not be inferred`);
  + }
  +
  + let version = match[1];
  +
  + if (!semver.valid(version)) {
  + core.debug(`Bundle version ${version} is not in SemVer format. Will treat it as pre-release 0.0.0-${version}.`);
  + version = '0.0.0-' + version;
  + }
  +
  + const s = semver.clean(version);
  + if (!s) {
  + throw new Error(`Malformed tools url ${url}. Version should be in SemVer format but have ${version} instead`);
  + }
  +
  + return s;
  +}
  \ No newline at end of file
  