Commit 444cb53
authored
ci: Enable GH Actions testing for forked PRs (#462)
# Changes
- Adds smoke test to ensure all modules are importable with only
required dependencies
- Updates workflows to use latest versions of actions
- Updates testing workflow to only test on latest versions of Redis
images
- Tests notebooks only on `redis-py==7.x`
- Adds process for supporting testing workflows on PRs from forked repos
- Adds `.github/workflows/test-fork-pr.yml` - Manual workflow for
testing fork PRs with secrets
- Adds `.github/actions/run-service-tests/action.yml` - Reusable
composite action for service tests
- Updates `.github/workflows/test.yml` to use the composite action and
skip service tests on fork PRs
# Fork PR Testing
GitHub does not provide repository secrets to workflows triggered by
`pull_request` events 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 PR` workflow 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:
- No malicious code that could exfiltrate secrets (e.g., logging
secrets, sending them to external endpoints)
- No code that modifies workflow files or test infrastructure to expose
secrets
- No attempts to access or modify cloud resources using the provided
credentials
- Test code changes are legitimate and don't introduce backdoors
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:
1. Review the fork PR code for security issues
2. Navigate to **Actions** → **Test Fork PR** workflow
3. Click **Run workflow**, enter the PR number, and click **Run
workflow** again
4. Test results will appear as a "Service Tests" check on the PR
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.1 parent ec3dbe3 commit 444cb53
File tree
7 files changed
+301
-63
lines changed- .github
- actions/run-service-tests
- workflows
- tests
7 files changed
+301
-63
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
| 23 | + | |
25 | 24 | | |
26 | 25 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 26 | + | |
39 | 27 | | |
40 | | - | |
41 | | - | |
| 28 | + | |
| 29 | + | |
42 | 30 | | |
43 | 31 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
| 32 | + | |
65 | 33 | | |
| 34 | + | |
66 | 35 | | |
| 36 | + | |
67 | 37 | | |
68 | 38 | | |
69 | 39 | | |
| |||
82 | 52 | | |
83 | 53 | | |
84 | 54 | | |
85 | | - | |
86 | | - | |
87 | 55 | | |
88 | 56 | | |
89 | | - | |
| 57 | + | |
90 | 58 | | |
91 | 59 | | |
92 | 60 | | |
93 | 61 | | |
94 | 62 | | |
95 | 63 | | |
96 | 64 | | |
97 | | - | |
98 | | - | |
| 65 | + | |
99 | 66 | | |
100 | | - | |
| 67 | + | |
101 | 68 | | |
102 | 69 | | |
103 | | - | |
| 70 | + | |
104 | 71 | | |
105 | 72 | | |
106 | 73 | | |
| |||
138 | 105 | | |
139 | 106 | | |
140 | 107 | | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
| 108 | + | |
151 | 109 | | |
152 | 110 | | |
153 | 111 | | |
| |||
156 | 114 | | |
157 | 115 | | |
158 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
159 | 128 | | |
160 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
161 | 135 | | |
162 | 136 | | |
163 | 137 | | |
| |||
180 | 154 | | |
181 | 155 | | |
182 | 156 | | |
183 | | - | |
| 157 | + | |
184 | 158 | | |
185 | 159 | | |
186 | 160 | | |
| |||
0 commit comments