-
Notifications
You must be signed in to change notification settings - Fork 65
ci: Enable GH Actions testing for forked PRs #462
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: main
Are you sure you want to change the base?
Conversation
916dfea to
2b4b9e3
Compare
|
Claude finished @vishal-bala's task —— View job Code Review: CI Workflow OptimizationsTodo List:
✅ Overall AssessmentThis PR introduces sensible CI optimizations that reduce resource usage while maintaining comprehensive test coverage. The changes are well-structured and follow GitHub Actions best practices. 🎯 Key Improvements1. Smart Import Testing # tests/test_imports.py:47-50
def sanity_check_imports(package_name: str) -> int:
# Clean implementation that walks all modules and reports failures clearly2. Efficient Resource Usage
3. Enhanced Fork PR Support
🔒 Security ReviewADDRESSED: The GitHub Advanced Security warning about missing permissions is correctly handled in the new fork PR workflow: # .github/workflows/test-fork-pr.yml:11-14
permissions:
contents: read
checks: write
pull-requests: readRECOMMENDATION: Consider adding explicit permissions to other workflows for consistency: # Missing from .github/workflows/test.yml
permissions:
contents: read🛠️ Technical DetailsWorkflow Structure:
Import Testing Integration: # .github/actions/run-service-tests/action.yml:47-50
- name: Test module imports
shell: bash
run: |
uv run python -m tests.test_imports redisvl📝 Minor Suggestions
✨ Code Quality
Verdict: ✅ Approve - This is a well-implemented optimization that improves CI efficiency while maintaining test coverage and security. |
Changes
redis-py==7.x.github/workflows/test-fork-pr.yml- Manual workflow for testing fork PRs with secrets.github/actions/run-service-tests/action.yml- Reusable composite action for service tests.github/workflows/test.ymlto use the composite action and skip service tests on fork PRsFork PR Testing
GitHub does not provide repository secrets to workflows triggered by
pull_requestevents from forks, even when maintainers approve the workflow run. This prevents our service tests from running on fork PRs since they require API keys for OpenAI, Cohere, Mistral, Voyage, Azure OpenAI, AWS, Google Cloud, and HuggingFace.This PR adds a new
Test Fork PRworkflow that maintainers can manually trigger after reviewing fork PR code. The workflow accepts a PR number as input, validates that it's from a fork, checks out the fork's code at the exact commit SHA, runs the full test suite with secrets, and posts results as a "Service Tests" check on the PR using the GitHub Checks API. This satisfies branch protection requirements while maintaining security through explicit maintainer review and SHA pinning to prevent race conditions.The service test logic has been extracted into a composite action (
.github/actions/run-service-tests/action.yml) to avoid duplication between the regular and fork PR workflows.Security Considerations
Important: The fork PR workflow runs untrusted code from external contributors with full access to repository secrets. Maintainers must carefully review fork PR code before triggering the workflow to ensure:
The workflow pins to the exact commit SHA at trigger time, preventing attackers from pushing malicious commits after approval. However, the initial review is critical since the workflow executes arbitrary Python code with access to production API keys and cloud credentials.
Maintainer Workflow for Fork PRs
When a PR is opened from an external fork, the regular test workflow runs but skips the service tests. To run the full test suite:
If the contributor pushes new commits, review the changes and re-trigger the workflow. Same-repository PRs continue to work as before with no manual intervention required.