Skip to content

Commit 98c991d

Browse files
Only use github.token on github.com (#443)
* Only use github.token on github.com This expression evaluates to `''` if called from GHES hosted elsewhere You can still provide your token on both github.com and GHES * Enshure blank result of expression and not false * Revert "Revert "Pass the `token` input through on GHES (#427)" (#437)" This reverts commit cf86e08. * fix typo * Add back the doc on the tool cache for self-hosted Co-authored-by: Brian Cristante <33549821+brcrista@users.noreply.github.com>
1 parent 397a35f commit 98c991d

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

action.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ inputs:
1616
description: "Set this option if you want the action to check for the latest available version that satisfies the version spec."
1717
default: false
1818
token:
19-
description: "Used to pull python distributions from actions/python-versions. Since there's a default, this is typically not supplied by the user."
20-
default: ${{ github.token }}
19+
description: "The token used to authenticate when 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."
20+
default: ${{ github.server_url == 'https://github.com' && github.token || '' }}
2121
cache-dependency-path:
2222
description: "Used to specify the path to dependency files. Supports wildcards or a list of file names for caching multiple dependencies."
2323
update-environment:

dist/setup/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -65190,7 +65190,7 @@ const tc = __importStar(__nccwpck_require__(7784));
6519065190
const exec = __importStar(__nccwpck_require__(1514));
6519165191
const utils_1 = __nccwpck_require__(1314);
6519265192
const TOKEN = core.getInput('token');
65193-
const AUTH = !TOKEN || utils_1.isGhes() ? undefined : `token ${TOKEN}`;
65193+
const AUTH = !TOKEN ? undefined : `token ${TOKEN}`;
6519465194
const MANIFEST_REPO_OWNER = 'actions';
6519565195
const MANIFEST_REPO_NAME = 'python-versions';
6519665196
const MANIFEST_REPO_BRANCH = 'main';

docs/advanced-usage.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -473,4 +473,13 @@ One quick way to grant access is to change the user and group of `/Users/runner/
473473

474474
`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 downloading that looks like: `##[error]API rate limit exceeded for...`.
475475

476-
To avoid hitting rate-limit problems, we recommend [setting up your own runner tool cache](https://docs.github.com/en/enterprise-server@2.22/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).
476+
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:
477+
478+
```yml
479+
uses: actions/setup-python@v4
480+
with:
481+
token: ${{ secrets.GH_DOTCOM_TOKEN }}
482+
python-version: 3.11
483+
```
484+
485+
If the runner is not able to access github.com, any Python versions requested during a workflow run must come from the runner's tool cache. See "[Setting up the tool cache on self-hosted runners without internet access](https://docs.github.com/en/enterprise-server@3.2/admin/github-actions/managing-access-to-actions-from-githubcom/setting-up-the-tool-cache-on-self-hosted-runners-without-internet-access)" for more information.

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, isGhes} from './utils';
6+
import {IS_WINDOWS, IS_LINUX} from './utils';
77

88
const TOKEN = core.getInput('token');
9-
const AUTH = !TOKEN || isGhes() ? undefined : `token ${TOKEN}`;
9+
const AUTH = !TOKEN ? 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)