From 0d351b9875600c236d85ccf3f3fedeabc3e1c4d7 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 21 Jun 2026 19:05:08 +0800 Subject: [PATCH] fix(ci): filter ClawSweeper comment dispatches before token minting (#95308) Merged via squash. Prepared head SHA: b5389b59e46b4dd4d7d4bad6984c9b63e0920b49 Co-authored-by: vincentkoc <25068+vincentkoc@users.noreply.github.com> Co-authored-by: vincentkoc <25068+vincentkoc@users.noreply.github.com> Reviewed-by: @vincentkoc --- .github/workflows/clawsweeper-dispatch.yml | 30 +++++++++++++++++----- scripts/lib/windows-taskkill.d.mts | 6 +++++ scripts/test-projects.test-support.mjs | 4 +++ src/scripts/test-projects.test.ts | 10 ++++++++ test/scripts/ci-node-test-plan.test.ts | 7 +++++ test/scripts/test-projects.test.ts | 8 ++++++ 6 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 scripts/lib/windows-taskkill.d.mts diff --git a/.github/workflows/clawsweeper-dispatch.yml b/.github/workflows/clawsweeper-dispatch.yml index 4b5d6b2344ad..369cb43a3c3a 100644 --- a/.github/workflows/clawsweeper-dispatch.yml +++ b/.github/workflows/clawsweeper-dispatch.yml @@ -81,9 +81,27 @@ jobs: repositories: clawsweeper permission-contents: write + - name: Pre-filter ClawSweeper comment + id: comment_filter + if: ${{ github.event_name == 'issue_comment' }} + env: + COMMENT_BODY: ${{ github.event.comment.body }} + run: | + set -euo pipefail + if grep -Eiq '(^|[[:space:]])@(clawsweeper|openclaw-clawsweeper)\b(\[bot\])?|(^|[[:space:]])/(clawsweeper|review|autoclose|auto([[:space:]]+|-)?merge)\b' <<< "$COMMENT_BODY"; then + echo "is_command=true" >> "$GITHUB_OUTPUT" + else + echo "is_command=false" >> "$GITHUB_OUTPUT" + fi + - name: Create target comment token id: target_token - if: ${{ github.event_name == 'issue_comment' && env.HAS_CLAWSWEEPER_APP_PRIVATE_KEY == 'true' }} + if: >- + ${{ + github.event_name == 'issue_comment' && + steps.comment_filter.outputs.is_command == 'true' && + env.HAS_CLAWSWEEPER_APP_PRIVATE_KEY == 'true' + }} uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1 with: client-id: ${{ env.CLAWSWEEPER_APP_CLIENT_ID }} @@ -213,7 +231,11 @@ jobs: fi - name: Acknowledge and dispatch ClawSweeper comment - if: ${{ github.event_name == 'issue_comment' }} + if: >- + ${{ + github.event_name == 'issue_comment' && + steps.comment_filter.outputs.is_command == 'true' + }} env: DISPATCH_TOKEN: ${{ steps.token.outputs.token }} TARGET_TOKEN: ${{ steps.target_token.outputs.token }} @@ -232,10 +254,6 @@ jobs: . "$RUNNER_TEMP/github-api-backoff.sh" body_file="$RUNNER_TEMP/clawsweeper-comment-body.txt" printf '%s\n' "$COMMENT_BODY" > "$body_file" - if ! grep -Eiq '(^|[[:space:]])@(clawsweeper|openclaw-clawsweeper)\b(\[bot\])?|(^|[[:space:]])/(clawsweeper|review|automerge|autoclose)\b' "$body_file"; then - echo "No ClawSweeper command found in comment." - exit 0 - fi if [ -n "$TARGET_TOKEN" ]; then err="$(mktemp)" if GH_TOKEN="$TARGET_TOKEN" gh_api_with_retry -X POST \ diff --git a/scripts/lib/windows-taskkill.d.mts b/scripts/lib/windows-taskkill.d.mts new file mode 100644 index 000000000000..bab088386a7e --- /dev/null +++ b/scripts/lib/windows-taskkill.d.mts @@ -0,0 +1,6 @@ +export function resolveWindowsTaskkillPath(env?: NodeJS.ProcessEnv): string; +export function resolveWindowsSystem32Path( + executableName: string, + env?: NodeJS.ProcessEnv, +): string; +export function resolveWindowsPowerShellPath(env?: NodeJS.ProcessEnv): string; diff --git a/scripts/test-projects.test-support.mjs b/scripts/test-projects.test-support.mjs index 2e1415d05749..db20886b18dd 100644 --- a/scripts/test-projects.test-support.mjs +++ b/scripts/test-projects.test-support.mjs @@ -1093,6 +1093,10 @@ const TOOLING_SOURCE_TEST_TARGETS = new Map([ "scripts/lib/windows-taskkill.mjs", ["test/scripts/managed-child-process.test.ts", "test/scripts/run-with-env.test.ts"], ], + [ + "scripts/lib/windows-taskkill.d.mts", + ["test/scripts/managed-child-process.test.ts", "test/scripts/run-with-env.test.ts"], + ], [ "scripts/lib/local-build-metadata.mjs", [ diff --git a/src/scripts/test-projects.test.ts b/src/scripts/test-projects.test.ts index b7678ca690c3..ed51b5aba29a 100644 --- a/src/scripts/test-projects.test.ts +++ b/src/scripts/test-projects.test.ts @@ -881,12 +881,22 @@ describe("test-projects args", () => { "test/scripts/android-pin-version.test.ts", "test/scripts/bench-cli-startup.test.ts", "test/scripts/check-package-dist-imports.test.ts", + "test/scripts/clawhub-fixture-server.test.ts", + "test/scripts/codex-install-assertions.test.ts", + "test/scripts/config-reload-mutate-metadata.test.ts", "test/scripts/control-ui-i18n.test.ts", + "test/scripts/doctor-install-switch-wrapper.test.ts", + "test/scripts/e2e-text-file-utils.test.ts", + "test/scripts/fixture-common.test.ts", + "test/scripts/fixture-plugin-commands.test.ts", + "test/scripts/incremental-line-reader.test.ts", "test/scripts/ios-configure-signing.test.ts", "test/scripts/ios-pin-version.test.ts", "test/scripts/ios-team-id.test.ts", "test/scripts/ios-version.test.ts", "test/scripts/kitchen-sink-rpc-walk.test.ts", + "test/scripts/onboard-config-fixtures.test.ts", + "test/scripts/parallels-lib-helpers.test.ts", "test/scripts/parallels-smoke-model.test.ts", "test/scripts/plugins-assertions.test.ts", "test/scripts/prepare-extension-package-boundary-artifacts.test.ts", diff --git a/test/scripts/ci-node-test-plan.test.ts b/test/scripts/ci-node-test-plan.test.ts index fe1f4343ce49..145aaa19e058 100644 --- a/test/scripts/ci-node-test-plan.test.ts +++ b/test/scripts/ci-node-test-plan.test.ts @@ -317,6 +317,12 @@ describe("scripts/lib/ci-node-test-plan.mjs", () => { runner: "blacksmith-4vcpu-ubuntu-2404", shardName: "core-runtime-infra-heartbeat-runner", }, + { + configs: ["test/vitest/vitest.infra.config.ts"], + requiresDist: false, + runner: "blacksmith-4vcpu-ubuntu-2404", + shardName: "core-runtime-infra-misc", + }, { configs: ["test/vitest/vitest.infra.config.ts"], requiresDist: false, @@ -473,6 +479,7 @@ describe("scripts/lib/ci-node-test-plan.mjs", () => { "core-runtime-infra-gateway-watch", "core-runtime-infra-heartbeat-core", "core-runtime-infra-heartbeat-runner", + "core-runtime-infra-misc", "core-runtime-infra-misc-dedupe-disk", "core-runtime-infra-misc-os", "core-runtime-infra-misc-values", diff --git a/test/scripts/test-projects.test.ts b/test/scripts/test-projects.test.ts index 018f7ec577ef..a972280fc365 100644 --- a/test/scripts/test-projects.test.ts +++ b/test/scripts/test-projects.test.ts @@ -1559,6 +1559,14 @@ describe("scripts/test-projects changed-target routing", () => { ["test/scripts/local-heavy-check-runtime.test.ts"], ], ["scripts/lib/managed-child-process.mjs", ["test/scripts/managed-child-process.test.ts"]], + [ + "scripts/lib/windows-taskkill.mjs", + ["test/scripts/managed-child-process.test.ts", "test/scripts/run-with-env.test.ts"], + ], + [ + "scripts/lib/windows-taskkill.d.mts", + ["test/scripts/managed-child-process.test.ts", "test/scripts/run-with-env.test.ts"], + ], ["scripts/lib/source-file-scan-cache.mjs", ["test/scripts/source-file-scan-cache.test.ts"]], ["scripts/lib/dev-tooling-safety.ts", ["test/scripts/dev-tooling-safety.test.ts"]], [