Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork178
Description
In my repository (https://github.com/opencontainers/runc) I use two distinct linter configs:
- one where all default linters, and some non-default ones, are enabled
- one where only a couple of extra linters are enabled
The first config is used everywhere (on main and release branches, as well as for PRs)
The second config is
- aimed at new code only (and so it has
only-new-issues: true) - aimed at PRs only (and so it has
if: github.event_name == 'pull_request')
The idea behind this setup is simple: since we have a pretty big codebase, we can't possibly modify it to satisfy some more stricter and/or opinionated linters (such asgodot,revive,gocritic, ordupl), nor it makes sense to do so -- but we can impose stricter standards for the newly added code.
Now, the GHA CI implementation (with the.golangci-extra.yml file with extra linters) looks like this:
jobs:lint:runs-on:ubuntu-20.04steps: -uses:actions/checkout@v3 -uses:actions/setup-go@v3with:go-version:"${{ env.GO_VERSION }}" -name:install depsrun:| sudo apt -q update sudo apt -q install libseccomp-dev -uses:golangci/golangci-lint-action@v3with:version:"${{ env.LINT_VERSION }}"# Extra linters, only checking new code from pull requests. -uses:golangci/golangci-lint-action@v3if:github.event_name == 'pull_request'with:only-new-issues:trueargs:--config .golangci-extra.ymlversion:"${{ env.LINT_VERSION }}"
All this works, except that since I usegolangci/golangci-lint-action twice, it actually downloads and installs golangci-lint twice (for example, see the log athttps://github.com/opencontainers/runc/runs/5982042602?check_suite_focus=true.
** Proposal ** modify the action to detect that it is being used for the second time, and skip the second, redundant golangci-lint setup.