Skip to content

Commit cf8b7a6

Browse files
committed
Refactor C# cache content paths into a function
1 parent ba454b8 commit cf8b7a6

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

lib/analyze-action.js

Lines changed: 4 additions & 1 deletion
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 & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/dependency-caching.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,17 @@ export function getJavaDependencyDirs(): string[] {
6666
];
6767
}
6868

69+
/**
70+
* Returns an array of paths of directories on the runner that should be included in a dependency cache
71+
* for a C# analysis.
72+
*
73+
* @returns The paths of directories on the runner that should be included in a dependency cache
74+
* for a C# analysis.
75+
*/
76+
export function getCsharpDependencyDirs(): string[] {
77+
return [join(os.homedir(), ".nuget", "packages")];
78+
}
79+
6980
/**
7081
* Checks that there are files which match `patterns`. If there are matching files for any of the patterns,
7182
* this function returns all `patterns`. Otherwise, `undefined` is returned.
@@ -158,7 +169,7 @@ const defaultCacheConfigs: { [language: string]: CacheConfig } = {
158169
]),
159170
},
160171
csharp: {
161-
getDependencyPaths: () => [join(os.homedir(), ".nuget", "packages")],
172+
getDependencyPaths: getCsharpDependencyDirs,
162173
getHashPatterns: getCsharpHashPatterns,
163174
},
164175
go: {

0 commit comments

Comments
 (0)