From 32fe77a9bfca59c8238958392e80e874d548c427 Mon Sep 17 00:00:00 2001 From: Liangsheng Yin Date: Wed, 19 Nov 2025 01:14:41 +0800 Subject: [PATCH] ... --- .github/workflows/pr-gate.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-gate.yml b/.github/workflows/pr-gate.yml index 0e2692862445..715f6950caaf 100644 --- a/.github/workflows/pr-gate.yml +++ b/.github/workflows/pr-gate.yml @@ -14,10 +14,10 @@ jobs: pr-gate: # 1. for commits on main: no gating needed # 2. for workflow_dispatch: this can only be triggered by users with write access - if: github.event_name == 'pull_request' runs-on: ubuntu-latest steps: - name: Fetch latest PR info + if: github.event_name == 'pull_request' id: pr uses: actions/github-script@v7 with: @@ -33,6 +33,7 @@ jobs: core.setOutput("user", pr.data.user.login); - name: Log PR info + if: github.event_name == 'pull_request' run: | echo "===== PR Info =====" echo "PR Event: ${{ github.event_name }}" @@ -44,13 +45,13 @@ jobs: echo "===================" - name: Block draft PR - if: fromJson(steps.pr.outputs.draft) + if: github.event_name == 'pull_request' && fromJson(steps.pr.outputs.draft) run: | echo "PR is draft. Blocking CI." exit 1 - name: Require run-ci label (optional) - if: inputs.require-run-ci == true + if: github.event_name == 'pull_request' && inputs.require-run-ci == true run: | labels='${{ steps.pr.outputs.labels }}' if [[ "${{ contains(fromJson(steps.pr.outputs.labels), 'run-ci') }}" == "false" ]]; then @@ -59,6 +60,7 @@ jobs: fi - name: Enforce rate limit for low-permission actors (optional) + if: github.event_name == 'pull_request' && inputs.rate-limit-hours > 0 uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }}