Skip to content

skip per-pr for draft PRs#2831

Merged
yzh119 merged 1 commit intoflashinfer-ai:mainfrom
aleozlx:per_pr
Mar 21, 2026
Merged

skip per-pr for draft PRs#2831
yzh119 merged 1 commit intoflashinfer-ai:mainfrom
aleozlx:per_pr

Conversation

@aleozlx
Copy link
Collaborator

@aleozlx aleozlx commented Mar 20, 2026

📌 Description

Saves testing capacity not running per-pr testing on draft PRs

🔍 Related Issues

🚀 Pull Request Checklist

Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete.

✅ Pre-commit Checks

  • I have installed pre-commit by running pip install pre-commit (or used your preferred method).
  • I have installed the hooks with pre-commit install.
  • I have run the hooks manually with pre-commit run --all-files and fixed any reported issues.

If you are unsure about how to set up pre-commit, see the pre-commit documentation.

🧪 Tests

  • Tests have been added or updated as needed.
  • All tests are passing (unittest, etc.).

Reviewer Notes

Summary by CodeRabbit

  • Chores
    • Updated CI/CD workflow to better handle draft pull requests. Tests are now automatically skipped for draft PRs and execute when marked as ready for review.

@gemini-code-assist
Copy link
Contributor

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 20, 2026

📝 Walkthrough

Walkthrough

The pull request updates the GitHub Actions workflow to respond to the ready_for_review event and adds an early guard that detects draft pull requests, setting CI authorization to false and skipping downstream job execution.

Changes

Cohort / File(s) Summary
CI Workflow Configuration
.github/workflows/pr-test.yml
Added ready_for_review event trigger and implemented draft PR detection in the gate job that sets authorized=false and exits early, preventing CI execution for draft PRs.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • yzh119
  • bkryu

Poem

🐰 A gate now watches with careful eyes,
Draft PRs caught before they rise,
The workflows pause with gentle grace,
ready_for_review finds its place! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description includes a brief purpose statement but lacks detailed explanation of implementation, related issues link, and complete checklist confirmation. Clarify what changes were made to skip draft PR testing, explicitly link any related issues, and provide more context about how the implementation works.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'skip per-pr for draft PRs' directly and clearly describes the main change - implementing logic to skip per-PR CI for draft pull requests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can customize the tone of the review comments and chat replies.

Configure the tone_instructions setting to customize the tone of the review comments and chat replies. For example, you can set the tone to Act like a strict teacher, Act like a pirate and more.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/pr-test.yml:
- Around line 73-78: The workflow currently sets authorized=false for draft PRs
which downstream logic treats as an authorization failure; instead stop
assigning authorized here and emit a distinct skip signal so downstream can
treat it as a deliberate skip. Replace the echo "authorized=false" in the draft
branch with an output like "skip_reason=draft" (or "skipped=true") and keep
authorized unset (or explicitly leave it true elsewhere only when real
authorization is granted) so downstream summary logic can detect
skip_reason/skipped and exit cleanly without treating it as an auth failure.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 490c55fa-147f-40a6-9d1f-63bc7884cf0c

📥 Commits

Reviewing files that changed from the base of the PR and between 6f0928c and ff88c6c.

📒 Files selected for processing (1)
  • .github/workflows/pr-test.yml

Comment on lines +73 to +78
# Skip draft PRs to save CI capacity
if [[ "${{ github.event.pull_request.draft }}" == "true" ]]; then
echo "authorized=false" >> "$GITHUB_OUTPUT"
echo "Draft PR, skipping CI"
exit 0
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Draft skip currently routes into “unauthorized” failure path.

Line 75 sets authorized=false for drafts, but downstream summary logic handles this as “pending authorization” and exits with failure. That makes draft PRs fail instead of being cleanly skipped.

💡 Proposed fix (distinguish skip reason from authorization)
   gate:
     name: Permission Check
     runs-on: ubuntu-latest
     outputs:
       authorized: ${{ steps.check.outputs.authorized }}
+      skip_reason: ${{ steps.check.outputs.skip_reason }}
@@
           if [[ "${{ github.event_name }}" != "pull_request" ]]; then
             echo "authorized=true" >> "$GITHUB_OUTPUT"
+            echo "skip_reason=none" >> "$GITHUB_OUTPUT"
             echo "Not a PR, authorized"
             exit 0
           fi

           # Skip draft PRs to save CI capacity
           if [[ "${{ github.event.pull_request.draft }}" == "true" ]]; then
             echo "authorized=false" >> "$GITHUB_OUTPUT"
+            echo "skip_reason=draft" >> "$GITHUB_OUTPUT"
             echo "Draft PR, skipping CI"
             exit 0
           fi
@@
           if [[ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci') }}" == "true" ]]; then
             echo "authorized=true" >> "$GITHUB_OUTPUT"
+            echo "skip_reason=none" >> "$GITHUB_OUTPUT"
             echo "PR has run-ci label, authorized"
             exit 0
           fi
@@
               echo "authorized=true" >> "$GITHUB_OUTPUT"
+              echo "skip_reason=none" >> "$GITHUB_OUTPUT"
@@
               echo "authorized=false" >> "$GITHUB_OUTPUT"
+              echo "skip_reason=unauthorized" >> "$GITHUB_OUTPUT"
@@
           if echo "$MEMBERS" | grep -qx "$AUTHOR"; then
             echo "authorized=true" >> "$GITHUB_OUTPUT"
+            echo "skip_reason=none" >> "$GITHUB_OUTPUT"
             echo "$AUTHOR is a member of $TEAM, authorized"
           else
             echo "authorized=false" >> "$GITHUB_OUTPUT"
+            echo "skip_reason=unauthorized" >> "$GITHUB_OUTPUT"
             echo "$AUTHOR is not a member of $TEAM, not authorized"
           fi
   test-results-summary:
@@
+      - name: Report draft PR status
+        if: needs.gate.outputs.skip_reason == 'draft'
+        run: |
+          echo "## Test Results Summary" >> $GITHUB_STEP_SUMMARY
+          echo "CI skipped (draft PR)" >> $GITHUB_STEP_SUMMARY
+          echo "::notice::Draft PR — CI skipped"
+          exit 0
+
       - name: Check Authorization
-        if: needs.gate.outputs.authorized != 'true'
+        if: needs.gate.outputs.authorized != 'true' && needs.gate.outputs.skip_reason != 'draft'
         uses: actions/checkout@v4
@@
       - name: Check skip patterns for unauthorized PRs
-        if: needs.gate.outputs.authorized != 'true'
+        if: needs.gate.outputs.authorized != 'true' && needs.gate.outputs.skip_reason != 'draft'
         id: skip-check
@@
       - name: Report unauthorized PR status
-        if: needs.gate.outputs.authorized != 'true'
+        if: needs.gate.outputs.authorized != 'true' && needs.gate.outputs.skip_reason != 'draft'
         run: |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/pr-test.yml around lines 73 - 78, The workflow currently
sets authorized=false for draft PRs which downstream logic treats as an
authorization failure; instead stop assigning authorized here and emit a
distinct skip signal so downstream can treat it as a deliberate skip. Replace
the echo "authorized=false" in the draft branch with an output like
"skip_reason=draft" (or "skipped=true") and keep authorized unset (or explicitly
leave it true elsewhere only when real authorization is granted) so downstream
summary logic can detect skip_reason/skipped and exit cleanly without treating
it as an auth failure.

@yzh119 yzh119 merged commit 1ddef01 into flashinfer-ai:main Mar 21, 2026
30 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants