diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 2c73c99d5e..bae40af55b 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -22,12 +22,6 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: - - name: list of changed files - id: getDiffFile - run: | - echo "::set-output name=files::$(git diff --name-only origin/master | grep '\.go$' | xargs)" - shell: bash - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v3 with: @@ -39,12 +33,31 @@ jobs: go-version-file: .go-version #go-version: '1.21' cache: false + + - name: Get list of changed files + id: getDiffFile + run: | + echo "::set-output name=files::$(git diff --name-only origin/master | grep '^tencentcloud/.*\.go$' | xargs)" + shell: bash + + - name: Check for changed Go files + id: checkDiffFile + run: | + if [ -z "${{ steps.getDiffFile.outputs.files }}" ]; then + echo "No Go files changed." + exit 0 + fi + + - name: Print changed files + id: showDiffFile + run: | + echo "Changed Go files: ${{ steps.getDiffFile.outputs.files }}" # Runs a set of commands using the runners shell - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - version: v1.48.0 + version: v1.63.4 #version: v1.54 working-directory: ./tencentcloud args: --new-from-rev=origin/master -v ${{ steps.getDiffFile.outputs.files }}