From a87cc89916b06b231946e757318c2e856d4f08f3 Mon Sep 17 00:00:00 2001 From: Jinzhe Pan <48981407+Eigensystem@users.noreply.github.com> Date: Tue, 31 Mar 2026 05:12:57 -0700 Subject: [PATCH] [ci] Trigger pre-commit on /test slash commands (#1205) --- .github/workflows/ci-precommit.yml | 2 +- .github/workflows/ci-slash-commands.yml | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-precommit.yml b/.github/workflows/ci-precommit.yml index fca4bcee0..7ca7cf79d 100644 --- a/.github/workflows/ci-precommit.yml +++ b/.github/workflows/ci-precommit.yml @@ -14,7 +14,7 @@ permissions: jobs: pre-commit: - if: github.event.pull_request.draft != true + if: github.event_name == 'workflow_call' || github.event.pull_request.draft != true runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/ci-slash-commands.yml b/.github/workflows/ci-slash-commands.yml index a5aa6a076..791b31f06 100644 --- a/.github/workflows/ci-slash-commands.yml +++ b/.github/workflows/ci-slash-commands.yml @@ -86,7 +86,7 @@ jobs: set -euo pipefail TEST_NAME=$(echo "$COMMENT" | grep -oP '(?<=/test\s)\S+' | head -1 || true) - VALID="encoder vae transformer kernel unit ssim training lora-inference lora-training distillation self-forcing vsa vmoba performance api full fastcheck" + VALID="encoder vae transformer kernel unit ssim training lora-inference lora-training distillation self-forcing vsa vmoba performance api full fastcheck pre-commit" if [ -z "$TEST_NAME" ] || ! echo "$VALID" | grep -qw "$TEST_NAME"; then echo "Unknown test: '$TEST_NAME'. Valid: $VALID" exit 1 @@ -114,6 +114,12 @@ jobs: echo "test_scope=fastcheck" echo "full_suite=false" } >> "$GITHUB_OUTPUT" + elif [ "$TEST_NAME" = "pre-commit" ]; then + { + echo "test_type=" + echo "test_scope=precommit" + echo "full_suite=false" + } >> "$GITHUB_OUTPUT" else { echo "test_type=${MAP[$TEST_NAME]}" @@ -136,6 +142,13 @@ jobs: core.setOutput('sha', pr.head.sha); core.setOutput('branch', pr.head.ref); + pre-commit: + needs: parse-command + if: >- + needs.parse-command.outputs.has_write == 'true' + && needs.parse-command.outputs.test_scope == 'precommit' + uses: ./.github/workflows/ci-precommit.yml + trigger-buildkite: needs: parse-command if: >-