diff --git a/.github/workflows/golangci-feature.yml b/.github/workflows/golangci-feature.yml new file mode 100644 index 00000000000..8e243335bcc --- /dev/null +++ b/.github/workflows/golangci-feature.yml @@ -0,0 +1,31 @@ +# golangci-feature runs on pull requests from branches that do not target main. +# +# Working on feature branches (PRs where the PR base-ref != main) is a common +# workflow used, in order to make the merging of PRs easier certain lints are excluded +# when it makes sense. Currently, unused lints are excluded since many PRs will add +# unused code that will be used in a later PR. +name: golangci-lint feature branch +on: + pull_request: + # Ignore if the target is main. (Negation of golanci-lint.yml) + branches-ignore: + - main +permissions: + contents: read + # Optional: allow read access to pull request. Use with `only-new-issues` option. + # pull-requests: read + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v4 + with: + go-version: 1.19 + - uses: actions/checkout@v3 + - name: golangci-lint + uses: golangci/golangci-lint-action@v3.4.0 + with: + version: v1.52.0 + args: --timeout 5m --exclude unused \ No newline at end of file diff --git a/.github/workflows/golangci.yml b/.github/workflows/golangci.yml index ce49a707781..baa26e7f157 100644 --- a/.github/workflows/golangci.yml +++ b/.github/workflows/golangci.yml @@ -1,3 +1,5 @@ +# golang-ci runs on pushes to main and to tags whose name starts with "v" and to pull +# requests from branches that target main. name: golangci-lint on: push: @@ -6,10 +8,13 @@ on: branches: - main pull_request: + branches: + - main permissions: contents: read # Optional: allow read access to pull request. Use with `only-new-issues` option. # pull-requests: read + jobs: golangci: name: lint