diff --git a/.github/workflows/gitleaks.yaml b/.github/workflows/gitleaks.yaml index 27a470f..eeb845f 100644 --- a/.github/workflows/gitleaks.yaml +++ b/.github/workflows/gitleaks.yaml @@ -19,14 +19,19 @@ jobs: persist-credentials: false - name: Set scan range id: range + env: + EVENT: ${{ github.event_name }} + BASE_SHA: ${{ github.event.pull_request.base.sha }} + BEFORE_SHA: ${{ github.event.before }} + FORCED: ${{ github.event.forced }} run: | NULL_SHA="0000000000000000000000000000000000000000" - if [ "${{ github.event_name }}" = "pull_request" ]; then - echo "log_opts=${{ github.event.pull_request.base.sha }}..HEAD" >> $GITHUB_OUTPUT - elif [ "${{ github.event.before }}" = "$NULL_SHA" ] || [ -z "${{ github.event.before }}" ] || [ "${{ github.event.forced }}" = "true" ]; then + if [ "$EVENT" = "pull_request" ]; then + echo "log_opts=${BASE_SHA}..HEAD" >> $GITHUB_OUTPUT + elif [ "$BEFORE_SHA" = "$NULL_SHA" ] || [ -z "$BEFORE_SHA" ] || [ "$FORCED" = "true" ]; then echo "log_opts=" >> $GITHUB_OUTPUT else - echo "log_opts=${{ github.event.before }}..HEAD" >> $GITHUB_OUTPUT + echo "log_opts=${BEFORE_SHA}..HEAD" >> $GITHUB_OUTPUT fi - uses: gitleaks/gitleaks-action@ff98106e4c7b2bc287b24eaf42907196329070c7 # v2.3.9 env: diff --git a/src/service.test.ts b/src/service.test.ts index 16e563a..cd262fa 100644 --- a/src/service.test.ts +++ b/src/service.test.ts @@ -2,13 +2,9 @@ import { readFile, rm } from "node:fs/promises"; import { join } from "node:path"; import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; -vi.mock("openclaw/plugin-sdk", async () => { - const actual = await vi.importActual("openclaw/plugin-sdk"); - return { - ...actual, - onDiagnosticEvent: vi.fn(() => vi.fn()), - }; -}); +vi.mock("openclaw/plugin-sdk", () => ({ + onDiagnosticEvent: vi.fn(() => vi.fn()), +})); import { createTelemetryService } from "./service.js";