Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
a691497
Clean up `resolve_supported_languages_using_cli` FF
henrymercer Oct 22, 2025
c228fec
Update changelog and version after v4.31.2
github-actions[bot] Oct 30, 2025
65da12b
Rebuild
github-actions[bot] Oct 30, 2025
9bd8638
Merge pull request #3262 from github/mergeback/v4.31.2-to-main-0499de31
henrymercer Oct 30, 2025
64db1da
Create immutable action version on tag push
mbg Oct 31, 2025
338146c
Merge pull request #3264 from github/mbg/ci/publish-on-tag
mbg Oct 31, 2025
7d1bed2
Bump @octokit/types from 15.0.1 to 16.0.0
dependabot[bot] Nov 3, 2025
8fa298d
Bump @actions/http-client from 2.2.3 to 3.0.0
dependabot[bot] Nov 3, 2025
5313cd1
Rebuild
github-actions[bot] Nov 3, 2025
61bcb70
Rebuild
github-actions[bot] Nov 3, 2025
7ad64f0
Merge pull request #3270 from github/dependabot/npm_and_yarn/actions/…
henrymercer Nov 3, 2025
97580d7
Merge pull request #3267 from github/dependabot/npm_and_yarn/octokit/…
henrymercer Nov 3, 2025
a3ea4ef
Bump the npm-minor group with 7 updates
dependabot[bot] Nov 3, 2025
85eb524
Rebuild
github-actions[bot] Nov 4, 2025
98e0ffe
Merge pull request #3266 from github/dependabot/npm_and_yarn/npm-mino…
henrymercer Nov 4, 2025
58f5e3d
Bump @types/archiver from 6.0.4 to 7.0.0
dependabot[bot] Nov 4, 2025
f23547c
Rebuild
github-actions[bot] Nov 4, 2025
493ffd8
Merge pull request #3268 from github/dependabot/npm_and_yarn/types/ar…
henrymercer Nov 4, 2025
a53b496
Bump @actions/io from 1.1.3 to 2.0.0
dependabot[bot] Nov 4, 2025
238f5f2
Rebuild
github-actions[bot] Nov 4, 2025
95b1867
Merge pull request #3269 from github/dependabot/npm_and_yarn/actions/…
henrymercer Nov 4, 2025
1aade29
Update deprecation warnings for CodeQL Action to v4
mario-campos Nov 4, 2025
5a9b49d
Update CHANGELOG to reflect warning for v3 users migrating to v4 of C…
mario-campos Nov 4, 2025
ba82f9b
Fix deprecation warning to reflect that v3 is not actually deprecated…
mario-campos Nov 4, 2025
f1ca6a4
Update tests to reflect deprecation status of CodeQL Action v3
mario-campos Nov 4, 2025
08dc635
Restore use of `sinon.match()`.
mario-campos Nov 4, 2025
b32a1e0
Update test cases for GitHub Enterprise Server versions 3.11 and 3.12…
mario-campos Nov 4, 2025
c443dff
Simplify warning language to not enumerate deprecated versions.
mario-campos Nov 4, 2025
9366f80
Reference GHES 3.20 in the comment, not 3.19.
mario-campos Nov 4, 2025
a570795
Clarify the CHANGELOG.md entry to reflect the whole action, and not j…
mario-campos Nov 4, 2025
9d5565f
Remove `macos-13` from `codeql` workflow
mbg Nov 4, 2025
d03fd76
Filter CCR jobs in `update-required-checks.sh`
mbg Nov 4, 2025
b00addd
Merge pull request #3274 from github/mbg/macos-13
mbg Nov 5, 2025
862f566
Merge pull request #3275 from github/mbg/checks/filter-ccr
mbg Nov 5, 2025
5aa2d63
Merge branch 'main' into mario-campos/v4-warning
mbg Nov 5, 2025
33684ef
Add `setup-python` step to `update-bundle` workflow
mbg Nov 5, 2025
c9f82f2
Move python script to file
mbg Nov 5, 2025
6dd11f7
Update .github/workflows/script/bundle_changelog.py
mbg Nov 5, 2025
423d14e
Merge pull request #3277 from github/mbg/ci/update-bundle-python
mbg Nov 5, 2025
e2ef519
Merge pull request #3224 from github/henrymercer/clean-up-resolve-lan…
henrymercer Nov 5, 2025
6a63bc6
Change warning message to just v3 (exclude v1, v2).
mario-campos Nov 5, 2025
ecee3ea
Update CHANGELOG.md.
mario-campos Nov 5, 2025
74f6621
Reformat with eslint
mario-campos Nov 5, 2025
b5e5a25
Merge branch 'main' into mario-campos/v4-warning
mario-campos Nov 5, 2025
1ca20ab
Add `CsharpNewCacheKey` FF
mbg Sep 17, 2025
2aa1f55
Propagate `features` into `cachePrefix` function
mbg Sep 17, 2025
2a7680f
Change `getDefaultCacheConfig` to be a `const` by turning `paths` int…
mbg Sep 17, 2025
ab1c842
Change `hash` to be a function that can use `Features`
mbg Sep 17, 2025
320a6b6
Merge pull request #3272 from github/mario-campos/v4-warning
mario-campos Nov 5, 2025
6b48207
Move check whether there are files for hashing into `getHashPatterns`
mbg Sep 17, 2025
0324490
Use additional files for C# key hashes if `Feature.CsharpNewCacheKey`…
mbg Sep 17, 2025
0cbd930
Move `createCacheKeyHash` to `caching-utils`
mbg Nov 5, 2025
03b2dc2
Add and use `getFeaturePrefix` for dependency caching
mbg Nov 5, 2025
2680455
Use `undefined` instead of `NoMatchingFilesError`
mbg Nov 5, 2025
04285cb
Use generic types for durations in status report
henrymercer Nov 5, 2025
71d0a56
Merge pull request #3278 from github/henrymercer/type-fun
henrymercer Nov 6, 2025
46e03b4
Fix JSDoc param name
mbg Nov 9, 2025
5b58b8f
Linter: check JSDoc parameter names exist
mbg Nov 9, 2025
71abac7
Fix comment in `getCsharpHashPatterns`
mbg Nov 9, 2025
35c91ef
Add tests for `getCsharpHashPatterns`
mbg Nov 9, 2025
b0e9dfc
Restore missing `status.push` resulting from a bad merge
mbg Nov 9, 2025
a47d550
Restore earlier log messages for `checkHashPatterns`
mbg Nov 9, 2025
4885eb2
Insert new `featurePrefix` after general cache key `prefix`
mbg Nov 9, 2025
48a56f6
Add some tests for `downloadDependencyCaches` related to feature pref…
mbg Nov 9, 2025
04bd5c6
Merge pull request #3279 from github/mbg/lint/jsdoc-param-names
mbg Nov 10, 2025
63bb415
Bump the npm-minor group with 4 updates
dependabot[bot] Nov 10, 2025
3d7be7b
Rebuild
github-actions[bot] Nov 10, 2025
1d9f357
Merge pull request #3281 from github/dependabot/npm_and_yarn/npm-mino…
henrymercer Nov 11, 2025
534824e
Merge pull request #3117 from github/mbg/csharp/new-cache-key-calcula…
mbg Nov 12, 2025
71c3720
Run `npm ci` in `update-supported-enterprise-server-versions.yml`
mbg Nov 12, 2025
a7e52b6
Perform sparse checkout
mbg Nov 12, 2025
fd830db
Trigger on PR for relevant changes
mbg Nov 12, 2025
7a7cd85
Don't push for PR event
mbg Nov 12, 2025
ba454b8
Merge pull request #3284 from github/mbg/ci/fix-enterprise-workflow
mbg Nov 12, 2025
362f8d1
Update default bundle to codeql-bundle-v2.23.5
github-actions[bot] Nov 13, 2025
8d3d400
Add changelog note
github-actions[bot] Nov 13, 2025
f20e021
Add support for adding `setup-dotnet` steps to `sync.sh`
mbg Nov 13, 2025
58c9eb6
Add `global.json`
mbg Nov 13, 2025
38a3a72
Enable `installDotNet` in all workflows that analyse C#
mbg Nov 13, 2025
3fac49c
Update remaining workflows
mbg Nov 13, 2025
456a74a
Merge pull request #3289 from github/mbg/ci/setup-dotnet
henrymercer Nov 13, 2025
9777b01
Merge branch 'main' into update-bundle/codeql-bundle-v2.23.5
mbg Nov 13, 2025
8c10e89
Merge pull request #3288 from github/update-bundle/codeql-bundle-v2.23.5
mbg Nov 13, 2025
14d898e
Update changelog for v4.31.3
github-actions[bot] Nov 13, 2025
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
Prev Previous commit
Next Next commit
Propagate features into cachePrefix function
  • Loading branch information
mbg committed Nov 5, 2025
commit 2aa1f55f3de4223926d2c91a55495bba67efc138
23 changes: 12 additions & 11 deletions lib/analyze-action.js

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

27 changes: 14 additions & 13 deletions lib/init-action.js

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

5 changes: 5 additions & 0 deletions lib/setup-codeql-action.js

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

5 changes: 5 additions & 0 deletions lib/start-proxy-action.js

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

7 changes: 2 additions & 5 deletions src/analyze-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,14 +438,11 @@ async function run() {

// Store dependency cache(s) if dependency caching is enabled.
if (shouldStoreCache(config.dependencyCachingEnabled)) {
const minimizeJavaJars = await features.getValue(
Feature.JavaMinimizeDependencyJars,
codeql,
);
dependencyCacheResults = await uploadDependencyCaches(
codeql,
features,
config,
logger,
minimizeJavaJars,
);
}

Expand Down
39 changes: 27 additions & 12 deletions src/dependency-caching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import * as glob from "@actions/glob";
import { getTemporaryDirectory } from "./actions-util";
import { listActionsCaches } from "./api-client";
import { getTotalCacheSize } from "./caching-utils";
import { CodeQL } from "./codeql";
import { Config } from "./config-utils";
import { EnvVar } from "./environment";
import { Feature, Features } from "./feature-flags";
import { KnownLanguage, Language } from "./languages";
import { Logger } from "./logging";
import { getErrorMessage, getRequiredEnvParam } from "./util";
Expand Down Expand Up @@ -110,15 +112,18 @@ export type DependencyCacheRestoreStatusReport = DependencyCacheRestoreStatus[];
/**
* Attempts to restore dependency caches for the languages being analyzed.
*
* @param codeql The CodeQL instance to use.
* @param features Information about which FFs are enabled.
* @param languages The languages being analyzed.
* @param logger A logger to record some informational messages to.
* @param minimizeJavaJars Whether the Java extractor should rewrite downloaded JARs to minimize their size.
*
* @returns An array of `DependencyCacheRestoreStatus` objects for each analysed language with a caching configuration.
*/
export async function downloadDependencyCaches(
codeql: CodeQL,
features: Features,
languages: Language[],
logger: Logger,
minimizeJavaJars: boolean,
): Promise<DependencyCacheRestoreStatusReport> {
const status: DependencyCacheRestoreStatusReport = [];

Expand All @@ -144,9 +149,9 @@ export async function downloadDependencyCaches(
continue;
}

const primaryKey = await cacheKey(language, cacheConfig, minimizeJavaJars);
const primaryKey = await cacheKey(codeql, features, language, cacheConfig);
const restoreKeys: string[] = [
await cachePrefix(language, minimizeJavaJars),
await cachePrefix(codeql, features, language),
];

logger.info(
Expand Down Expand Up @@ -203,16 +208,18 @@ export type DependencyCacheUploadStatusReport = DependencyCacheUploadStatus[];
/**
* Attempts to store caches for the languages that were analyzed.
*
* @param codeql The CodeQL instance to use.
* @param features Information about which FFs are enabled.
* @param config The configuration for this workflow.
* @param logger A logger to record some informational messages to.
* @param minimizeJavaJars Whether the Java extractor should rewrite downloaded JARs to minimize their size.
*
* @returns An array of `DependencyCacheUploadStatus` objects for each analysed language with a caching configuration.
*/
export async function uploadDependencyCaches(
codeql: CodeQL,
features: Features,
config: Config,
logger: Logger,
minimizeJavaJars: boolean,
): Promise<DependencyCacheUploadStatusReport> {
const status: DependencyCacheUploadStatusReport = [];
for (const language of config.languages) {
Expand Down Expand Up @@ -258,7 +265,7 @@ export async function uploadDependencyCaches(
continue;
}

const key = await cacheKey(language, cacheConfig, minimizeJavaJars);
const key = await cacheKey(codeql, features, language, cacheConfig);

logger.info(
`Uploading cache of size ${size} for ${language} with key ${key}...`,
Expand Down Expand Up @@ -299,31 +306,35 @@ export async function uploadDependencyCaches(
/**
* Computes a cache key for the specified language.
*
* @param codeql The CodeQL instance to use.
* @param features Information about which FFs are enabled.
* @param language The language being analyzed.
* @param cacheConfig The cache configuration for the language.
* @param minimizeJavaJars Whether the Java extractor should rewrite downloaded JARs to minimize their size.
* @returns A cache key capturing information about the project(s) being analyzed in the specified language.
*/
async function cacheKey(
codeql: CodeQL,
features: Features,
language: Language,
cacheConfig: CacheConfig,
minimizeJavaJars: boolean = false,
): Promise<string> {
const hash = await glob.hashFiles(cacheConfig.hash.join("\n"));
return `${await cachePrefix(language, minimizeJavaJars)}${hash}`;
return `${await cachePrefix(codeql, features, language)}${hash}`;
}

/**
* Constructs a prefix for the cache key, comprised of a CodeQL-specific prefix, a version number that
* can be changed to invalidate old caches, the runner's operating system, and the specified language name.
*
* @param codeql The CodeQL instance to use.
* @param features Information about which FFs are enabled.
* @param language The language being analyzed.
* @param minimizeJavaJars Whether the Java extractor should rewrite downloaded JARs to minimize their size.
* @returns The prefix that identifies what a cache is for.
*/
async function cachePrefix(
codeql: CodeQL,
features: Features,
language: Language,
minimizeJavaJars: boolean,
): Promise<string> {
const runnerOs = getRequiredEnvParam("RUNNER_OS");
const customPrefix = process.env[EnvVar.DEPENDENCY_CACHING_PREFIX];
Expand All @@ -334,6 +345,10 @@ async function cachePrefix(
}

// To ensure a safe rollout of JAR minimization, we change the key when the feature is enabled.
const minimizeJavaJars = await features.getValue(
Feature.JavaMinimizeDependencyJars,
codeql,
);
if (language === KnownLanguage.java && minimizeJavaJars) {
prefix = `minify-${prefix}`;
}
Expand Down
9 changes: 3 additions & 6 deletions src/init-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,15 +578,12 @@ async function run() {
}

// Restore dependency cache(s), if they exist.
const minimizeJavaJars = await features.getValue(
Feature.JavaMinimizeDependencyJars,
codeql,
);
if (shouldRestoreCache(config.dependencyCachingEnabled)) {
dependencyCachingResults = await downloadDependencyCaches(
codeql,
features,
config.languages,
logger,
minimizeJavaJars,
);
}

Expand Down Expand Up @@ -648,7 +645,7 @@ async function run() {
`${EnvVar.JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS} is already set to '${process.env[EnvVar.JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS]}', so the Action will not override it.`,
);
} else if (
minimizeJavaJars &&
(await features.getValue(Feature.JavaMinimizeDependencyJars, codeql)) &&
config.dependencyCachingEnabled &&
config.buildMode === BuildMode.None &&
config.languages.includes(KnownLanguage.java)
Expand Down