-
Notifications
You must be signed in to change notification settings - Fork 209
Improve fork safety: consolidate approval and add pull_request trigger #2097
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
base: master
Are you sure you want to change the base?
Improve fork safety: consolidate approval and add pull_request trigger #2097
Conversation
- Add pull_request trigger for internal PRs (non-forks) to test workflow changes immediately - Keep pull_request_target for fork PRs that need access to secrets - Move approval step to test-all-warehouses.yml (runs once instead of per-platform) - Remove per-platform approval from test-warehouse.yml to reduce spam Fixes ELE-5221 Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
👋 @devin-ai-integration[bot] |
📝 WalkthroughWalkthroughAdded centralized fork-detection and manual approval gating to the main test orchestration workflow; removed per-warehouse approval gating and updated workflow triggers/conditions to handle Changes
Sequence DiagramsequenceDiagram
participant GH as GitHub (Event)
participant Checker as check-fork-status
participant Approver as approve-fork
participant Orchestrator as test-all-warehouses (test job)
participant Warehouse as test-warehouse.yml
GH->>Checker: PR event (pull_request or pull_request_target)
activate Checker
Checker->>Checker: determine is_fork / should_skip
deactivate Checker
alt PR is from a fork
Checker->>Approver: requires approval
activate Approver
Approver->>Approver: wait for manual environment approval
Approver-->>Orchestrator: approval granted
deactivate Approver
else internal PR
Checker-->>Orchestrator: proceed without approval
end
activate Orchestrator
Orchestrator->>Warehouse: invoke `test-warehouse.yml` (resolved elementary-ref / head SHA)
Warehouse->>Warehouse: run warehouse tests
Warehouse-->>Orchestrator: results
deactivate Orchestrator
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
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: 1
🤖 Fix all issues with AI agents
In @.github/workflows/test-all-warehouses.yml:
- Around line 78-83: The current if condition for the test job uses always(),
which lets the job run even when check-fork-status failed and left outputs
empty; update the guard to require the check-fork-status job succeeded by adding
a result check (e.g., require needs.check-fork-status.result == 'success') to
the existing condition for the test job so that the test job only proceeds when
check-fork-status completed successfully; locate the test job's if block
referencing needs.check-fork-status.outputs and modify it to also assert
needs.check-fork-status.result == 'success' (or replace always() with success())
so the test job will be blocked when check-fork-status fails.
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
Summary
This PR improves the fork testing workflow by:
pull_requesttrigger for internal PRs (non-forks) so workflow changes can be tested immediately without waiting for mergepull_request_targetfor fork PRs that need access to secretstest-warehouse.ymltotest-all-warehouses.ymlso approval happens once instead of per-platform (reduces approval spam)pull_request_target, fork PRs skippull_request)Trigger behavior after this change:
pull_request(no approval needed)pull_request_target(single approval required)Fixes ELE-5221
Updates since last revision
always()to! cancelled()in the test job condition so that cancelling the workflow still behaves as expectedneeds.check-fork-status.result == 'success'guard to prevent tests from running if the fork check job fails (when it fails, outputs are empty strings which could bypass the skip logic)Review & Testing Checklist for Human
elementary_test_envenvironment before accessing secrets - the approval gate should only trigger forpull_request_targetfrom forksshould_skipcondition should correctly skippull_requestevents from forks andpull_request_targetevents from non-forks! cancelled())pull_requestwithout approval; have someone create a fork PR to verify it requires approvalRecommended test plan:
Notes
This is part of a two-repo change - the companion PR for
dbt-data-reliabilityis elementary-data/dbt-data-reliability#919Link to Devin run: https://app.devin.ai/sessions/268e854e9d814cd4a6e23511732beb37
Requested by: Itamar Hartstein (@haritamar)
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.