From a5e078e0a77019fe27031e8994e14522cd9b39de Mon Sep 17 00:00:00 2001 From: Actions Verification Date: Fri, 21 Aug 2026 09:04:21 +0800 Subject: [PATCH] fix(actions): add manual CI and security triggers --- .github/workflows/backend-ci.yml | 1 + .github/workflows/security-scan.yml | 1 + backend/internal/service/update_service.go | 2 +- backend/internal/service/update_service_test.go | 10 ++++++++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/backend-ci.yml b/.github/workflows/backend-ci.yml index 6c4a028c96c3..2fa2cefdf30b 100644 --- a/.github/workflows/backend-ci.yml +++ b/.github/workflows/backend-ci.yml @@ -3,6 +3,7 @@ name: CI on: push: pull_request: + workflow_dispatch: permissions: contents: read diff --git a/.github/workflows/security-scan.yml b/.github/workflows/security-scan.yml index 0e68d950ac5f..8df8ef2261c1 100644 --- a/.github/workflows/security-scan.yml +++ b/.github/workflows/security-scan.yml @@ -3,6 +3,7 @@ name: Security Scan on: push: pull_request: + workflow_dispatch: schedule: - cron: '0 3 * * 1' diff --git a/backend/internal/service/update_service.go b/backend/internal/service/update_service.go index 659ee2c33189..4155104e8ad3 100644 --- a/backend/internal/service/update_service.go +++ b/backend/internal/service/update_service.go @@ -460,7 +460,7 @@ func (s *UpdateService) fetchLatestSourceVersion(ctx context.Context) (*UpdateIn } latestVersion := strings.TrimSpace(string(raw)) if canonicalVersion(latestVersion) == "" { - return nil, fmt.Errorf("Fork version file contains invalid semantic version %q", latestVersion) + return nil, fmt.Errorf("fork version file contains invalid semantic version %q", latestVersion) } return &UpdateInfo{ diff --git a/backend/internal/service/update_service_test.go b/backend/internal/service/update_service_test.go index 99ef67944e07..0ca803ead9af 100644 --- a/backend/internal/service/update_service_test.go +++ b/backend/internal/service/update_service_test.go @@ -108,6 +108,16 @@ func TestUpdateServiceSourceBuildTracksForkVersionFile(t *testing.T) { require.Empty(t, client.latestRepo, "源码构建不能查询官方或 Fork 的二进制 Release") } +func TestUpdateServiceSourceBuildRejectsInvalidForkVersion(t *testing.T) { + client := &updateServiceGitHubClientStub{repositoryFile: []byte("not-semver\n")} + svc := NewUpdateService(&updateServiceCacheStub{}, client, "0.1.176-overdraft.1", "source") + + info, err := svc.CheckUpdate(context.Background(), true) + + require.NoError(t, err) + require.Equal(t, `fork version file contains invalid semantic version "not-semver"`, info.Warning) +} + func TestUpdateServiceSourceBuildIgnoresLegacyOfficialCache(t *testing.T) { cache := &updateServiceCacheStub{data: `{"latest":"0.1.176","timestamp":4102444800}`} client := &updateServiceGitHubClientStub{repositoryFile: []byte("0.1.176-overdraft.1\n")}