Skip to content

Commit

Permalink
adding comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Badal Kumar Prusty authored and Badal Kumar Prusty committed Oct 16, 2024
1 parent 148963a commit b8e0770
Showing 1 changed file with 36 additions and 21 deletions.
57 changes: 36 additions & 21 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,56 @@
name: golangci-lint
# Workflow name: Go Linter (golangci-lint)
name: Go Linter

# Trigger the workflow on pull request events
on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
types: [opened, edited, reopened, synchronize]
branches:
- 'main'
- 'rc-*'
- 'hotfix-*'
- 'develop'

# Set permissions for the GITHUB_TOKEN
permissions:
contents: read
contents: read # Only read access to the repository contents is needed for linting

# Define the jobs to run
jobs:
golangci:
name: lint
golangci-lint:
name: Lint Go Code
runs-on: ubuntu-latest
strategy:
matrix:
working-directory: [common-lib, authenticator, chart-sync,kubewatch,git-sensor,kubelink,lens]
# Define the directories to run linting on
working-directory: [common-lib, authenticator, chart-sync, kubewatch, git-sensor, kubelink, lens]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
# Step 1: Check out the repository
- name: Check out code
uses: actions/checkout@v4

# Step 2: Set up Go environment
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- if: ${{ matrix.working-directory=='common-lib' }}
run: cd common-lib && go get oras.land/oras-go/pkg/auth/docker && go mod tidy && go mod download && go mod vendor
name: installing oras.land package for common-lib
go-version: stable # Use the latest stable version of Go

# Step 3: Install dependencies for common-lib (if applicable)
- name: Install common-lib dependencies
if: ${{ matrix.working-directory == 'common-lib' }}
run: |
cd common-lib
go get oras.land/oras-go/pkg/auth/docker
go mod tidy
go mod download
go mod vendor
- name: golangci-lint-${{ matrix.working-directory }}
# Step 4: Run golangci-lint
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.61
args: --timeout=30m --tests=false --verbose
only-new-issues: "true"
working-directory: ${{ matrix.working-directory }}
version: v1.61 # Specify the version of golangci-lint to use
args: --timeout=30m --tests=false --verbose # Set linting arguments
only-new-issues: "true" # Only report new issues
working-directory: ${{ matrix.working-directory }} # Set the working directory based on the matrix

0 comments on commit b8e0770

Please sign in to comment.