Skip to content

Commit b7694f3

Browse files
committed
fix: add support for alternate name for env var: SERPAPI_KEY
1 parent 6fd9aad commit b7694f3

5 files changed

Lines changed: 22 additions & 6 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ jobs:
165165
github.event_name == 'workflow_dispatch'
166166
env:
167167
SERPAPI_API_KEY: ${{ secrets.SERPAPI_API_KEY }}
168+
SERPAPI_KEY: ${{ secrets.SERPAPI_KEY }}
168169
SERPAPI_WEEKLY: ${{ github.event_name == 'schedule' && '1' || '0' }}
169170
SERPAPI_LIVE_KEY_ARTIFACT: live-response-keys.json
170171
steps:
@@ -176,7 +177,7 @@ jobs:
176177

177178
- run: uv sync --dev --locked
178179
- name: Require the live-test API key
179-
run: test -n "$SERPAPI_API_KEY"
180+
run: test -n "$SERPAPI_API_KEY" || test -n "$SERPAPI_KEY"
180181
- name: Run live search suite
181182
run: uv run tox -e live
182183
- name: Upload weekly response-key inventory
@@ -196,6 +197,7 @@ jobs:
196197
github.event_name == 'workflow_dispatch'
197198
env:
198199
SERPAPI_API_KEY: ${{ secrets.SERPAPI_API_KEY }}
200+
SERPAPI_KEY: ${{ secrets.SERPAPI_KEY }}
199201
strategy:
200202
fail-fast: false
201203
matrix:
@@ -248,7 +250,7 @@ jobs:
248250

249251
- run: uv sync --dev --locked
250252
- name: Require the live-test API key
251-
run: test -n "$SERPAPI_API_KEY"
253+
run: test -n "$SERPAPI_API_KEY" || test -n "$SERPAPI_KEY"
252254
- name: Run one real search through the native SDK tool
253255
run: >-
254256
uv run tox -e ${{ matrix.tox-environment }} --

‎.github/workflows/release.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ jobs:
5454
runs-on: ubuntu-latest
5555
env:
5656
SERPAPI_API_KEY: ${{ secrets.SERPAPI_API_KEY }}
57+
SERPAPI_KEY: ${{ secrets.SERPAPI_KEY }}
5758
steps:
5859
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
5960
- uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
@@ -71,7 +72,7 @@ jobs:
7172
uv pip install --python .release-venv/bin/python dist/*.whl
7273
.release-venv/bin/python tests/clean_install_smoke.py
7374
- name: Require the live-test API key
74-
run: test -n "$SERPAPI_API_KEY"
75+
run: test -n "$SERPAPI_API_KEY" || test -n "$SERPAPI_KEY"
7576
- name: Run live search suite with the exact release wheel
7677
run: |
7778
uv pip install --python .release-venv/bin/python "pytest>=8.4,<9"

‎.github/workflows/testpypi.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
runs-on: ubuntu-latest
5656
env:
5757
SERPAPI_API_KEY: ${{ secrets.SERPAPI_API_KEY }}
58+
SERPAPI_KEY: ${{ secrets.SERPAPI_KEY }}
5859
steps:
5960
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
6061
with:
@@ -74,7 +75,7 @@ jobs:
7475
uv pip install --python .testpypi-venv/bin/python dist/*.whl
7576
.testpypi-venv/bin/python tests/clean_install_smoke.py
7677
- name: Require the live-test API key
77-
run: test -n "$SERPAPI_API_KEY"
78+
run: test -n "$SERPAPI_API_KEY" || test -n "$SERPAPI_KEY"
7879
- name: Run live search suite with the exact TestPyPI wheel
7980
run: |
8081
uv pip install --python .testpypi-venv/bin/python "pytest>=8.4,<9"

‎docs/user_guide/31-contributing.qmd‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ supported SDK adapters before publishing.
6868

6969
Configure a protected GitHub environment named `testpypi`, restrict it to
7070
`main`, and create a TestPyPI Trusted Publisher for workflow `testpypi.yml` and
71-
environment `testpypi`. The live wheel gate also requires the repository's
72-
`SERPAPI_API_KEY` secret. No TestPyPI password or API token is stored in GitHub.
71+
environment `testpypi`. The live wheel gate also requires a repository secret
72+
named `SERPAPI_API_KEY` or `SERPAPI_KEY`. No TestPyPI password or API token is
73+
stored in GitHub.
7374

7475
Run the workflow from the Actions page with `main` selected. Duplicate versions
7576
fail intentionally because TestPyPI does not allow a project version to be

‎tests/test_docs_site.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@ def test_testpypi_workflow_is_manual_main_only_and_matches_release_gates() -> No
287287
assert "testpypi-distributions" in verify
288288
assert "tests/clean_install_smoke.py" in verify
289289
assert "tests/test_live.py" in verify
290+
assert "SERPAPI_API_KEY: ${{ secrets.SERPAPI_API_KEY }}" in verify
291+
assert "SERPAPI_KEY: ${{ secrets.SERPAPI_KEY }}" in verify
292+
assert 'test -n "$SERPAPI_API_KEY" || test -n "$SERPAPI_KEY"' in verify
290293

291294
frameworks = _workflow_job_text(workflow, "framework-tests")
292295
assert "needs: test" in frameworks
@@ -315,7 +318,10 @@ def test_ci_separates_quality_basic_framework_and_live_checks() -> None:
315318
live_adapters = _workflow_job_text(ci, "live-adapters")
316319

317320
assert "SERPAPI_API_KEY" not in frameworks
321+
assert "SERPAPI_KEY" not in frameworks
318322
assert "SERPAPI_API_KEY: ${{ secrets.SERPAPI_API_KEY }}" in live
323+
assert "SERPAPI_KEY: ${{ secrets.SERPAPI_KEY }}" in live
324+
assert 'test -n "$SERPAPI_API_KEY" || test -n "$SERPAPI_KEY"' in live
319325
assert "needs: quality" in live
320326
assert "github.event_name == 'push' && github.ref == 'refs/heads/main'" in live
321327
assert "github.event_name == 'schedule'" in live
@@ -325,6 +331,8 @@ def test_ci_separates_quality_basic_framework_and_live_checks() -> None:
325331

326332
assert "needs: quality" in live_adapters
327333
assert "SERPAPI_API_KEY: ${{ secrets.SERPAPI_API_KEY }}" in live_adapters
334+
assert "SERPAPI_KEY: ${{ secrets.SERPAPI_KEY }}" in live_adapters
335+
assert 'test -n "$SERPAPI_API_KEY" || test -n "$SERPAPI_KEY"' in live_adapters
328336
assert "tests/test_live_adapters.py" in live_adapters
329337

330338

@@ -344,6 +352,9 @@ def test_release_workflow_uses_pypi_trusted_publishing() -> None:
344352
assert "\n verify-distributions:\n" in release
345353
assert "tests/clean_install_smoke.py" in release
346354
assert "tests/test_live.py" in release
355+
assert "SERPAPI_API_KEY: ${{ secrets.SERPAPI_API_KEY }}" in verify_distributions
356+
assert "SERPAPI_KEY: ${{ secrets.SERPAPI_KEY }}" in verify_distributions
357+
assert 'test -n "$SERPAPI_API_KEY" || test -n "$SERPAPI_KEY"' in verify_distributions
347358
assert 'python-version: "3.14"' in verify_distributions
348359
assert "\n framework-tests:\n" in release
349360
assert "tox-environment:" in _workflow_job_text(release, "framework-tests")

0 commit comments

Comments
 (0)