From 5aa218156edfbaccb2909c2847e654a67efa6678 Mon Sep 17 00:00:00 2001 From: SevenEarth <391613297@qq.com> Date: Tue, 7 Jan 2025 17:08:32 +0800 Subject: [PATCH 1/3] add --- .github/workflows/golangci-lint.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 2c73c99d5e..745692bdf7 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,23 @@ 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 '\.go$' | xargs)" + shell: bash + + - 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 }} From 9800c5a21ad71bbfe9697d6b71f1711c2127f947 Mon Sep 17 00:00:00 2001 From: SevenEarth <391613297@qq.com> Date: Tue, 7 Jan 2025 17:14:30 +0800 Subject: [PATCH 2/3] add --- .github/workflows/golangci-lint.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 745692bdf7..91aa726554 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -40,6 +40,14 @@ jobs: echo "::set-output name=files::$(git diff --name-only origin/master | grep '\.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: | From 9a460d5acfc1092627c90c4af5664785009f7f95 Mon Sep 17 00:00:00 2001 From: SevenEarth <391613297@qq.com> Date: Tue, 7 Jan 2025 17:23:07 +0800 Subject: [PATCH 3/3] add --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 91aa726554..bae40af55b 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -37,7 +37,7 @@ jobs: - name: Get list of changed files id: getDiffFile run: | - echo "::set-output name=files::$(git diff --name-only origin/master | grep '\.go$' | xargs)" + echo "::set-output name=files::$(git diff --name-only origin/master | grep '^tencentcloud/.*\.go$' | xargs)" shell: bash - name: Check for changed Go files