10
0
Fork 0
mirror of https://github.com/actions/setup-python.git synced 2026-04-06 09:56:54 +00:00
setup-python/__tests__
Ludovic Henry 8b57351c0f feat: Add mirror and mirror-token inputs for custom Python distribution sources
Users who need custom CPython builds (internal mirrors, GHES-hosted forks,
special build configurations, compliance builds, air-gapped runners) could not
previously point setup-python at anything other than actions/python-versions.

Adds two new inputs:
- `mirror`: base URL hosting versions-manifest.json and the Python
  distributions it references. Defaults to the existing
  https://raw.githubusercontent.com/actions/python-versions/main.
- `mirror-token`: optional token used to authenticate requests to the mirror.

If `mirror` is a raw.githubusercontent.com/{owner}/{repo}/{branch} URL, the
manifest is fetched via the GitHub REST API (authenticated rate limit applies);
otherwise the action falls back to a direct GET of {mirror}/versions-manifest.json.

Token interaction
-----------------

`token` is never forwarded to arbitrary hosts. Auth resolution is per-URL:

  1. if mirror-token is set, use mirror-token
  2. else if token is set AND the target host is github.com,
     *.github.com, or *.githubusercontent.com, use token
  3. else send no auth

Cases:

  Default (no inputs set)
    mirror = default raw.githubusercontent.com URL, mirror-token empty,
    token = github.token.
    → manifest API call and tarball downloads use `token`.
    Identical to prior behavior.

  Custom raw.githubusercontent.com mirror (e.g. personal fork)
    mirror-token empty, token = github.token.
    → manifest API call and tarball downloads use `token`
      (target hosts are GitHub-owned).

  Custom non-GitHub mirror, no mirror-token
    mirror-token empty, token = github.token.
    → manifest fetched via direct URL (no auth attached),
      tarball downloads use no auth.
    `token` is NOT forwarded to the custom host — this is the
    leak-prevention case.

  Custom non-GitHub mirror with mirror-token
    mirror-token set, token may be set.
    → manifest fetch and tarball downloads use `mirror-token`.

  Custom GitHub mirror with both tokens set
    mirror-token wins. Used for both the manifest API call and
    tarball downloads.
2026-04-06 01:17:51 +02:00
..
data Bump urllib3 from 2.6.0 to 2.6.3 in /__tests__/data (#1264) 2026-01-21 20:49:33 -06:00
cache-restore.test.ts Bump pyinstaller from 3.6 to 5.13.1 in /__tests__/data (#923) 2024-08-13 14:03:23 -05:00
cache-save.test.ts Add warning for empty cache paths (#642) 2023-04-06 12:02:34 +02:00
check-python-path.sh feature: add a python-path output 2022-05-24 21:02:03 +02:00
find-graalpy.test.ts graalpy: add graalpy early-access and windows builds (#880) 2025-10-22 11:16:57 -05:00
find-pypy.test.ts Update action to node20 (#772) 2023-12-05 14:52:09 +01:00
find-python.test.ts Support free threaded Python versions like '3.13t' (#973) 2025-03-04 16:49:43 -06:00
finder.test.ts Support free threaded Python versions like '3.13t' (#973) 2025-03-04 16:49:43 -06:00
install-graalpy.test.ts graalpy: add graalpy early-access and windows builds (#880) 2025-10-22 11:16:57 -05:00
install-pypy.test.ts Update action to node20 (#772) 2023-12-05 14:52:09 +01:00
install-python.test.ts feat: Add mirror and mirror-token inputs for custom Python distribution sources 2026-04-06 01:17:51 +02:00
test-pipenv.py Fix pipenv jobs (#699) 2023-07-13 14:11:40 +02:00
utils.test.ts Add version parsing from Pipfile (#1067) 2025-07-24 17:40:39 -05:00
verify-freethreaded.py Add e2e Testing for free threaded and Bump @action/cache from 4.0.0 to 4.0.3 (#1056) 2025-03-24 11:19:17 -05:00
verify-python.py Improve workflows (#88) 2020-05-01 18:52:58 +02:00