Skip to content

Commit 7525c68

Browse files
committed
Nit: Dedupe languages
1 parent 01bc9be commit 7525c68

8 files changed

Lines changed: 54 additions & 21 deletions

File tree

lib/analyze-action.js

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

lib/init-action-post.js

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

lib/init-action.js

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

lib/setup-codeql-action.js

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

lib/upload-lib.js

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

lib/upload-sarif-action.js

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

src/overlay/caching.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,32 @@ test.serial(
391391
},
392392
);
393393

394+
test.serial(
395+
"getCodeQlVersionsForOverlayBaseDatabases de-duplicates resolved language aliases",
396+
async (t) => {
397+
const logger = getRunnerLogger(true);
398+
399+
sinon.stub(apiClient, "getAutomationID").resolves("test-automation-id/");
400+
const listActionsCachesStub = sinon
401+
.stub(apiClient, "listActionsCaches")
402+
.resolves([
403+
{
404+
key: "codeql-overlay-base-database-1-c5666c509a2d9895-javascript_python-2.25.0-abc123-1-1",
405+
},
406+
]);
407+
408+
const result = await getCodeQlVersionsForOverlayBaseDatabases(
409+
["javascript", "typescript", "Python", "python"],
410+
logger,
411+
);
412+
t.deepEqual(result, ["2.25.0"]);
413+
sinon.assert.calledOnceWithExactly(
414+
listActionsCachesStub,
415+
"codeql-overlay-base-database-1-c5666c509a2d9895-javascript_python-",
416+
);
417+
},
418+
);
419+
394420
test.serial(
395421
"getCodeQlVersionsForOverlayBaseDatabases ignores nightly versions with build metadata",
396422
async (t) => {

src/overlay/caching.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,10 @@ export async function getCodeQlVersionsForOverlayBaseDatabases(
461461
);
462462
return undefined;
463463
}
464-
const cacheKeyPrefix = await getCacheKeyPrefixBase(
465-
languages.filter((l) => l !== undefined),
466-
);
464+
const dedupedLanguages = [
465+
...new Set(languages.filter((l) => l !== undefined)),
466+
];
467+
const cacheKeyPrefix = await getCacheKeyPrefixBase(dedupedLanguages);
467468

468469
logger.debug(
469470
`Searching for overlay-base databases in Actions cache with ` +

0 commit comments

Comments
 (0)