Skip to content

Commit cf86e08

Browse files
authored
Revert "Pass the token input through on GHES (#427)" (#437)
This reverts commit 7e4abae.
1 parent 8fb4cbf commit cf86e08

File tree

5 files changed

+7
-14
lines changed

5 files changed

+7
-14
lines changed

README.md

+1-8
Original file line numberDiff line numberDiff line change
@@ -366,14 +366,7 @@ If you are experiencing problems while configuring Python on your self-hosted ru
366366

367367
`setup-python` comes pre-installed on the appliance with GHES if Actions is enabled. When dynamically downloading Python distributions, `setup-python` downloads distributions from [`actions/python-versions`](https://github.com/actions/python-versions) on github.com (outside of the appliance). These calls to `actions/python-versions` are made via unauthenticated requests, which are limited to [60 requests per hour per IP](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting). If more requests are made within the time frame, then you will start to see rate-limit errors during download that read `##[error]API rate limit exceeded for...`.
368368

369-
To get a higher rate limit, you can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token` input for the action:
370-
371-
```yml
372-
uses: actions/setup-python@v4
373-
with:
374-
token: ${{ secrets.GH_DOTCOM_TOKEN }}
375-
python-version: 3.11
376-
```
369+
To avoid hitting rate-limit problems, we recommend [setting up your own runner tool cache](https://docs.github.com/en/[email protected]/admin/github-actions/managing-access-to-actions-from-githubcom/setting-up-the-tool-cache-on-self-hosted-runners-without-internet-access#about-the-included-setup-actions-and-the-runner-tool-cache).
377370

378371
# License
379372

action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ inputs:
1313
architecture:
1414
description: 'The target architecture (x86, x64) of the Python interpreter.'
1515
token:
16-
description: The token used to authenticate when to fetching Python distributions from https://github.com/actions/python-versions. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting.
16+
description: Used to pull python distributions from actions/python-versions. Since there's a default, this is typically not supplied by the user.
1717
default: ${{ github.token }}
1818
cache-dependency-path:
1919
description: 'Used to specify the path to dependency files. Supports wildcards or a list of file names for caching multiple dependencies.'

dist/setup/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -64432,7 +64432,7 @@ const tc = __importStar(__nccwpck_require__(7784));
6443264432
const exec = __importStar(__nccwpck_require__(1514));
6443364433
const utils_1 = __nccwpck_require__(1314);
6443464434
const TOKEN = core.getInput('token');
64435-
const AUTH = !TOKEN ? undefined : `token ${TOKEN}`;
64435+
const AUTH = !TOKEN || utils_1.isGhes() ? undefined : `token ${TOKEN}`;
6443664436
const MANIFEST_REPO_OWNER = 'actions';
6443764437
const MANIFEST_REPO_NAME = 'python-versions';
6443864438
const MANIFEST_REPO_BRANCH = 'main';

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/install-python.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import * as core from '@actions/core';
33
import * as tc from '@actions/tool-cache';
44
import * as exec from '@actions/exec';
55
import {ExecOptions} from '@actions/exec/lib/interfaces';
6-
import {IS_WINDOWS, IS_LINUX} from './utils';
6+
import {IS_WINDOWS, IS_LINUX, isGhes} from './utils';
77

88
const TOKEN = core.getInput('token');
9-
const AUTH = !TOKEN ? undefined : `token ${TOKEN}`;
9+
const AUTH = !TOKEN || isGhes() ? undefined : `token ${TOKEN}`;
1010
const MANIFEST_REPO_OWNER = 'actions';
1111
const MANIFEST_REPO_NAME = 'python-versions';
1212
const MANIFEST_REPO_BRANCH = 'main';

0 commit comments

Comments
 (0)