From 69214259a495e39d942fc9e25a74a5349c2ab4a8 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 12 Sep 2026 21:59:01 +0800 Subject: [PATCH 1/2] chore: upgrade Go and CI dependencies - Require Go 1.26 and test Go 1.26 and 1.27 with separate caches. - Update Go modules and GitHub Actions to current stable versions. - Preserve legacy token-limit compatibility with scoped lint exceptions. --- .github/workflows/codeql.yml | 6 +++--- .github/workflows/docker.yml | 20 ++++++++++---------- .github/workflows/goreleaser.yml | 6 +++--- .github/workflows/testing.yml | 22 +++++++++++----------- .github/workflows/trivy.yml | 4 ++-- CLAUDE.md | 4 ++-- Dockerfile | 2 +- go.mod | 6 +++--- go.sum | 8 ++++---- main.go | 2 +- main_test.go | 3 ++- 11 files changed, 42 insertions(+), 41 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 2281087..4c4366c 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -38,11 +38,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v7 + uses: actions/checkout@v7.0.1 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v4 + uses: github/codeql-action/init@v4.38.0 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -51,4 +51,4 @@ jobs: # queries: ./path/to/local/query, your-org/your-repo/queries@main - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v4 + uses: github/codeql-action/analyze@v4.38.0 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 051fd48..b100ba2 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v7 + uses: actions/checkout@v7.0.1 with: fetch-depth: 0 @@ -27,7 +27,7 @@ jobs: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} - name: Login to GitHub Container Registry - uses: docker/login-action@v4 + uses: docker/login-action@v4.6.0 with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -44,7 +44,7 @@ jobs: severity: "CRITICAL,HIGH" - name: Upload Trivy results to GitHub Security tab (scheduled) - uses: github/codeql-action/upload-sarif@v4 + uses: github/codeql-action/upload-sarif@v4.38.0 if: (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && always() with: sarif_file: "trivy-docker-results.sarif" @@ -60,17 +60,17 @@ jobs: # Build and scan workflow for push/PR - name: Setup go - uses: actions/setup-go@v7 + uses: actions/setup-go@v7.0.0 if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' with: go-version: "stable" - name: Set up QEMU - uses: docker/setup-qemu-action@v4 + uses: docker/setup-qemu-action@v4.3.0 if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v4 + uses: docker/setup-buildx-action@v4.3.0 if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' - name: Get version info @@ -89,7 +89,7 @@ jobs: - name: Docker meta id: docker-meta if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' - uses: docker/metadata-action@v6 + uses: docker/metadata-action@v6.2.0 with: images: | ghcr.io/${{ env.REPO }} @@ -100,7 +100,7 @@ jobs: type=semver,pattern={{major}} - name: Build for scanning - uses: docker/build-push-action@v7 + uses: docker/build-push-action@v7.3.0 if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' with: context: . @@ -124,7 +124,7 @@ jobs: severity: "CRITICAL,HIGH" - name: Upload Trivy results to GitHub Security tab - uses: github/codeql-action/upload-sarif@v4 + uses: github/codeql-action/upload-sarif@v4.38.0 if: (github.event_name != 'schedule' && github.event_name != 'workflow_dispatch') && always() with: sarif_file: "trivy-docker-results.sarif" @@ -139,7 +139,7 @@ jobs: exit-code: "1" - name: Build and push - uses: docker/build-push-action@v7 + uses: docker/build-push-action@v7.3.0 if: github.event_name != 'pull_request' && github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' with: context: . diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index d1b6c29..f14e5bc 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -13,16 +13,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v7 + uses: actions/checkout@v7.0.1 with: fetch-depth: 0 - name: Setup go - uses: actions/setup-go@v7 + uses: actions/setup-go@v7.0.0 with: go-version: "stable" - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v7 + uses: goreleaser/goreleaser-action@v7.2.3 with: # either 'goreleaser' (default) or 'goreleaser-pro' distribution: goreleaser diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 97fefd1..8d4451e 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -9,16 +9,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Setup go - uses: actions/setup-go@v7 + uses: actions/setup-go@v7.0.0 with: go-version: "stable" - name: Checkout repository - uses: actions/checkout@v7 + uses: actions/checkout@v7.0.1 - name: Setup golangci-lint - uses: golangci/golangci-lint-action@v9 + uses: golangci/golangci-lint-action@v9.3.0 with: - version: v2.13 + version: v2.13.2 args: --verbose - uses: hadolint/hadolint-action@v3.5.0 @@ -30,7 +30,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - go: ["1.25"] + go: ["1.26", "1.27"] include: - os: ubuntu-latest go-build: ~/.cache/go-build @@ -41,28 +41,28 @@ jobs: GOPROXY: https://proxy.golang.org steps: - name: Set up Go ${{ matrix.go }} - uses: actions/setup-go@v7 + uses: actions/setup-go@v7.0.0 with: go-version: ${{ matrix.go }} - name: Checkout Code - uses: actions/checkout@v7 + uses: actions/checkout@v7.0.1 with: ref: ${{ github.ref }} - - uses: actions/cache@v6 + - uses: actions/cache@v6.1.0 with: path: | ${{ matrix.go-build }} ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('**/go.sum') }} restore-keys: | - ${{ runner.os }}-go- + ${{ runner.os }}-go-${{ matrix.go }}- - name: Run Tests run: | go test -race -cover -coverprofile=coverage.out ./... - name: Upload coverage to Codecov - uses: codecov/codecov-action@v7 + uses: codecov/codecov-action@v7.0.0 with: flags: ${{ matrix.os }},go-${{ matrix.go }} diff --git a/.github/workflows/trivy.yml b/.github/workflows/trivy.yml index afff711..c45777d 100644 --- a/.github/workflows/trivy.yml +++ b/.github/workflows/trivy.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v7 + uses: actions/checkout@v7.0.1 - name: Run Trivy vulnerability scanner in repo mode uses: aquasecurity/trivy-action@v0.36.0 @@ -33,7 +33,7 @@ jobs: scanners: 'vuln,secret,misconfig' - name: Upload Trivy results to GitHub Security tab - uses: github/codeql-action/upload-sarif@v4 + uses: github/codeql-action/upload-sarif@v4.38.0 if: always() with: sarif_file: 'trivy-results.sarif' diff --git a/CLAUDE.md b/CLAUDE.md index 289e335..22bbab2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -21,7 +21,7 @@ go test -v -run TestName ./... ### Linting ```bash -# Run golangci-lint (requires golangci-lint v2.6) +# Run golangci-lint (requires golangci-lint v2.13) golangci-lint run --verbose # Check Dockerfile @@ -128,7 +128,7 @@ go run . ## Code Style & Standards -- Go version: 1.25 +- Go version: 1.26 - Linter configuration in `.golangci.yml` includes: gosec, govet, staticcheck, errcheck, and formatting tools (gofmt, gofumpt, goimports, golines) - Security scanning via gosec is enabled; intentional security exceptions are marked with `#nosec` comments - All tests should include race detection (`-race` flag) diff --git a/Dockerfile b/Dockerfile index 51cf33f..c09e076 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.25-alpine AS builder +FROM golang:1.26-alpine AS builder # Build arguments for version injection ARG VERSION=dev diff --git a/go.mod b/go.mod index 15ea9bf..c5b9fab 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,10 @@ module github.com/appleboy/LLM-action -go 1.25.0 +go 1.26.0 require ( - github.com/appleboy/com v1.2.0 - github.com/sashabaranov/go-openai v1.41.2 + github.com/appleboy/com v1.2.1 + github.com/sashabaranov/go-openai v1.42.1 ) require github.com/yassinebenaid/godump v0.11.1 diff --git a/go.sum b/go.sum index 77269e0..fe3cc94 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ -github.com/appleboy/com v1.2.0 h1:3jyA+yVofe/uzPHHa7Xrsj7rnDy1sZn/8pYHdzHB3GQ= -github.com/appleboy/com v1.2.0/go.mod h1:XK2kV+JWz/gkzsDPotNJL+aS6XCy5GNlbiTWGvIhqIU= -github.com/sashabaranov/go-openai v1.41.2 h1:vfPRBZNMpnqu8ELsclWcAvF19lDNgh1t6TVfFFOPiSM= -github.com/sashabaranov/go-openai v1.41.2/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg= +github.com/appleboy/com v1.2.1 h1:4bqaVFSxy1Q3mRotTIcF8TLryTet0652iNDNVV16skM= +github.com/appleboy/com v1.2.1/go.mod h1:KKYavyU5ejOp8c4vW+daKMf6Dw2DxE9IjqmWAhy0huo= +github.com/sashabaranov/go-openai v1.42.1 h1:9nK2UgDVVSIyoEUNDeWqu3Ttj8EqCO6FT8HK0Cv8VEo= +github.com/sashabaranov/go-openai v1.42.1/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg= github.com/yassinebenaid/godump v0.11.1 h1:SPujx/XaYqGDfmNh7JI3dOyCUVrG0bG2duhO3Eh2EhI= github.com/yassinebenaid/godump v0.11.1/go.mod h1:dc/0w8wmg6kVIvNGAzbKH1Oa54dXQx8SNKh4dPRyW44= diff --git a/main.go b/main.go index 493d225..30c5085 100644 --- a/main.go +++ b/main.go @@ -151,7 +151,7 @@ func buildChatRequest( // max_completion_tokens so existing configs keep working. req.MaxCompletionTokens = config.MaxTokens default: - req.MaxTokens = config.MaxTokens + req.MaxTokens = config.MaxTokens //nolint:staticcheck // Preserve max_tokens for compatible services and non-reasoning models. } if isReasoningModel(config.Model) { diff --git a/main_test.go b/main_test.go index 169a1fa..9de1452 100644 --- a/main_test.go +++ b/main_test.go @@ -88,7 +88,8 @@ func TestBuildChatRequest(t *testing.T) { t.Run(tt.name, func(t *testing.T) { req := buildChatRequest(tt.config, messages, nil) - if req.MaxTokens != tt.expectedMaxTokens { + if req.MaxTokens != tt.expectedMaxTokens { //nolint:staticcheck // Verify legacy max_tokens compatibility. + //nolint:staticcheck // Report the legacy field. t.Errorf("MaxTokens = %d, want %d", req.MaxTokens, tt.expectedMaxTokens) } if req.MaxCompletionTokens != tt.expectedMaxCompletionTokens { From 0aef47f67a0e8e24428dc1f1be3004186077b0e1 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 12 Sep 2026 22:02:29 +0800 Subject: [PATCH 2/2] ci: use major version tags for actions - Use floating major tags where upstream provides them. - Retain exact Trivy and Hadolint versions because major tags are unavailable. --- .github/workflows/codeql.yml | 6 +++--- .github/workflows/docker.yml | 20 ++++++++++---------- .github/workflows/goreleaser.yml | 6 +++--- .github/workflows/testing.yml | 14 +++++++------- .github/workflows/trivy.yml | 4 ++-- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 4c4366c..2281087 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -38,11 +38,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v7.0.1 + uses: actions/checkout@v7 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v4.38.0 + uses: github/codeql-action/init@v4 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -51,4 +51,4 @@ jobs: # queries: ./path/to/local/query, your-org/your-repo/queries@main - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v4.38.0 + uses: github/codeql-action/analyze@v4 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b100ba2..051fd48 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v7.0.1 + uses: actions/checkout@v7 with: fetch-depth: 0 @@ -27,7 +27,7 @@ jobs: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} - name: Login to GitHub Container Registry - uses: docker/login-action@v4.6.0 + uses: docker/login-action@v4 with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -44,7 +44,7 @@ jobs: severity: "CRITICAL,HIGH" - name: Upload Trivy results to GitHub Security tab (scheduled) - uses: github/codeql-action/upload-sarif@v4.38.0 + uses: github/codeql-action/upload-sarif@v4 if: (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && always() with: sarif_file: "trivy-docker-results.sarif" @@ -60,17 +60,17 @@ jobs: # Build and scan workflow for push/PR - name: Setup go - uses: actions/setup-go@v7.0.0 + uses: actions/setup-go@v7 if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' with: go-version: "stable" - name: Set up QEMU - uses: docker/setup-qemu-action@v4.3.0 + uses: docker/setup-qemu-action@v4 if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v4.3.0 + uses: docker/setup-buildx-action@v4 if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' - name: Get version info @@ -89,7 +89,7 @@ jobs: - name: Docker meta id: docker-meta if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' - uses: docker/metadata-action@v6.2.0 + uses: docker/metadata-action@v6 with: images: | ghcr.io/${{ env.REPO }} @@ -100,7 +100,7 @@ jobs: type=semver,pattern={{major}} - name: Build for scanning - uses: docker/build-push-action@v7.3.0 + uses: docker/build-push-action@v7 if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' with: context: . @@ -124,7 +124,7 @@ jobs: severity: "CRITICAL,HIGH" - name: Upload Trivy results to GitHub Security tab - uses: github/codeql-action/upload-sarif@v4.38.0 + uses: github/codeql-action/upload-sarif@v4 if: (github.event_name != 'schedule' && github.event_name != 'workflow_dispatch') && always() with: sarif_file: "trivy-docker-results.sarif" @@ -139,7 +139,7 @@ jobs: exit-code: "1" - name: Build and push - uses: docker/build-push-action@v7.3.0 + uses: docker/build-push-action@v7 if: github.event_name != 'pull_request' && github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' with: context: . diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index f14e5bc..d1b6c29 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -13,16 +13,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v7.0.1 + uses: actions/checkout@v7 with: fetch-depth: 0 - name: Setup go - uses: actions/setup-go@v7.0.0 + uses: actions/setup-go@v7 with: go-version: "stable" - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v7.2.3 + uses: goreleaser/goreleaser-action@v7 with: # either 'goreleaser' (default) or 'goreleaser-pro' distribution: goreleaser diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 8d4451e..8ff5d3f 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -9,14 +9,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Setup go - uses: actions/setup-go@v7.0.0 + uses: actions/setup-go@v7 with: go-version: "stable" - name: Checkout repository - uses: actions/checkout@v7.0.1 + uses: actions/checkout@v7 - name: Setup golangci-lint - uses: golangci/golangci-lint-action@v9.3.0 + uses: golangci/golangci-lint-action@v9 with: version: v2.13.2 args: --verbose @@ -41,16 +41,16 @@ jobs: GOPROXY: https://proxy.golang.org steps: - name: Set up Go ${{ matrix.go }} - uses: actions/setup-go@v7.0.0 + uses: actions/setup-go@v7 with: go-version: ${{ matrix.go }} - name: Checkout Code - uses: actions/checkout@v7.0.1 + uses: actions/checkout@v7 with: ref: ${{ github.ref }} - - uses: actions/cache@v6.1.0 + - uses: actions/cache@v6 with: path: | ${{ matrix.go-build }} @@ -63,6 +63,6 @@ jobs: go test -race -cover -coverprofile=coverage.out ./... - name: Upload coverage to Codecov - uses: codecov/codecov-action@v7.0.0 + uses: codecov/codecov-action@v7 with: flags: ${{ matrix.os }},go-${{ matrix.go }} diff --git a/.github/workflows/trivy.yml b/.github/workflows/trivy.yml index c45777d..afff711 100644 --- a/.github/workflows/trivy.yml +++ b/.github/workflows/trivy.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v7.0.1 + uses: actions/checkout@v7 - name: Run Trivy vulnerability scanner in repo mode uses: aquasecurity/trivy-action@v0.36.0 @@ -33,7 +33,7 @@ jobs: scanners: 'vuln,secret,misconfig' - name: Upload Trivy results to GitHub Security tab - uses: github/codeql-action/upload-sarif@v4.38.0 + uses: github/codeql-action/upload-sarif@v4 if: always() with: sarif_file: 'trivy-results.sarif'