-
Notifications
You must be signed in to change notification settings - Fork 204
only check fork on PR events #2011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
only check fork on PR events #2011
Conversation
WalkthroughExpanded the GitHub Actions workflow condition to trigger the approval check for all pull_request* events (e.g., pull_request, pull_request_target). The fork-detection logic and outputs remain unchanged. The step still writes requires_approval=true when the event matches and the PR originates from a fork; otherwise false. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant GH as GitHub Event
participant WF as Workflow: test-warehouse
participant ST as Step: Approval Check
GH->>WF: Trigger on event (pull_request*, push, etc.)
WF->>ST: Run conditional step
alt Event name starts with "pull_request"
ST->>ST: Check if head.repo.full_name != repository (fork)
alt From fork
ST->>WF: Set requires_approval=true (GITHUB_OUTPUT)
else Not from fork
ST->>WF: Set requires_approval=false
end
else Other events
ST->>WF: Set requires_approval=false
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. Comment |
|
👋 @haritamar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
.github/workflows/test-warehouse.yml (2)
87-91: Fork check now applies to all pull_request events; confirm scope and tighten/bash‑idioms.*This regex will also match pull_request_review and pull_request_review_comment. If that’s intended, LGTM—otherwise narrow to only pull_request and pull_request_target. Also, prefer glob over regex here and quote $GITHUB_OUTPUT.
Option A (keep broad scope; simplify and harden):
- if [[ "${{ github.event_name }}" =~ ^pull_request && "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then - echo "requires_approval=true" >> $GITHUB_OUTPUT + set -euo pipefail + if [[ "${{ github.event_name }}" == pull_request* && "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then + echo "requires_approval=true" >> "$GITHUB_OUTPUT" echo "requires_approval=false" >> $GITHUB_OUTPUT - echo "requires_approval=false" >> $GITHUB_OUTPUT + echo "requires_approval=false" >> "$GITHUB_OUTPUT"Option B (restrict to only PR/PR_target):
- if [[ "${{ github.event_name }}" =~ ^pull_request && "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then + if [[ "${{ github.event_name }}" =~ ^pull_request(_target)?$ && "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; thenPlease confirm which scope you want.
78-79: Update comment to reflect broadened condition.Comment says “specifically with the pull_request_target event,” but the condition now handles all pull_request* events. Adjust for accuracy.
- # PRs from forks require approval, specifically with the "pull_request_target" event as it contains repo secrets. + # PRs from forks require approval on pull_request* events; pull_request_target exposes repo secrets after environment approval.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
.github/workflows/test-warehouse.yml(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: test / test
- GitHub Check: Cursor Bugbot
null
Summary by CodeRabbit