Skip to content

Commit 58bce52

Browse files
committed
add working-directory and build
1 parent 59f1813 commit 58bce52

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

dist/post_run/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67348,9 +67348,14 @@ function buildCacheKeys() {
6734867348
// TODO: configure it via inputs.
6734967349
let cacheKey = `golangci-lint.cache-${getIntervalKey(7)}-`;
6735067350
keys.push(cacheKey);
67351-
if (yield pathExists(`go.mod`)) {
67351+
// Get working directory from input
67352+
const workingDirectory = core.getInput(`working-directory`);
67353+
// create path to go.mod prepending the workingDirectory if it exists
67354+
const goModPath = path_1.default.join(workingDirectory, `go.mod`);
67355+
core.info(`Checking for go.mod: ${goModPath}`);
67356+
if (yield pathExists(goModPath)) {
6735267357
// Add checksum to key to invalidate a cache when dependencies change.
67353-
cacheKey += yield checksumFile(`sha1`, `go.mod`);
67358+
cacheKey += yield checksumFile(`sha1`, goModPath);
6735467359
}
6735567360
else {
6735667361
cacheKey += `nogomod`;

dist/run/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67348,9 +67348,14 @@ function buildCacheKeys() {
6734867348
// TODO: configure it via inputs.
6734967349
let cacheKey = `golangci-lint.cache-${getIntervalKey(7)}-`;
6735067350
keys.push(cacheKey);
67351-
if (yield pathExists(`go.mod`)) {
67351+
// Get working directory from input
67352+
const workingDirectory = core.getInput(`working-directory`);
67353+
// create path to go.mod prepending the workingDirectory if it exists
67354+
const goModPath = path_1.default.join(workingDirectory, `go.mod`);
67355+
core.info(`Checking for go.mod: ${goModPath}`);
67356+
if (yield pathExists(goModPath)) {
6735267357
// Add checksum to key to invalidate a cache when dependencies change.
67353-
cacheKey += yield checksumFile(`sha1`, `go.mod`);
67358+
cacheKey += yield checksumFile(`sha1`, goModPath);
6735467359
}
6735567360
else {
6735667361
cacheKey += `nogomod`;

src/cache.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,14 @@ async function buildCacheKeys(): Promise<string[]> {
5656
// TODO: configure it via inputs.
5757
let cacheKey = `golangci-lint.cache-${getIntervalKey(7)}-`
5858
keys.push(cacheKey)
59-
60-
if (await pathExists(`go.mod`)) {
59+
// Get working directory from input
60+
const workingDirectory = core.getInput(`working-directory`)
61+
// create path to go.mod prepending the workingDirectory if it exists
62+
const goModPath = path.join(workingDirectory, `go.mod`)
63+
core.info(`Checking for go.mod: ${goModPath}`)
64+
if (await pathExists(goModPath)) {
6165
// Add checksum to key to invalidate a cache when dependencies change.
62-
cacheKey += await checksumFile(`sha1`, `go.mod`)
66+
cacheKey += await checksumFile(`sha1`, goModPath)
6367
} else {
6468
cacheKey += `nogomod`
6569
}

0 commit comments

Comments
 (0)