You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to run the action in a sub directory of my mono repo but it seems that the caching isn't working properly meaning my linting job is always slow as it has to build from scratch.
Step defined as
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.41
working-directory: service
I noticed the following in the post Job action log Cache hit occurred on the primary key golangci-lint.cache-2707-nogomod, not saving cache.
which surprised me as I do have a go.mod file.
Looking at the code for the action I think it is because the cache key build doesn't respect the change of working directory and as the linter is running in the top level of the repository looks for the go.mod file there.
I've been able to work around by handling caching myself as below but would reduce complexity if the listing action could handle this.
I think the caching worked for you, it even says so in the message: "Cache hit occurred". Not entirely as expected, though, as it ignores the go.mod, as you noticed. This seems to be due to the working-directory input being used only for running the linter ("run golangci-lint"), but not for restoring the cache (happens in "prepare environment"), during which go.mod existence is checked, and which runs in the repository root.
I'm trying to run the action in a sub directory of my mono repo but it seems that the caching isn't working properly meaning my linting job is always slow as it has to build from scratch.
Step defined as
I noticed the following in the post Job action log
Cache hit occurred on the primary key golangci-lint.cache-2707-nogomod, not saving cache.
which surprised me as I do have a go.mod file.
Looking at the code for the action I think it is because the cache key build doesn't respect the change of working directory and as the linter is running in the top level of the repository looks for the go.mod file there.
I've been able to work around by handling caching myself as below but would reduce complexity if the listing action could handle this.
The text was updated successfully, but these errors were encountered: