Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 98c991d

Browse filesBrowse files
Only use github.token on github.com (actions#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 (actions#427)" (actions#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
Copy full SHA for 98c991d

File tree

Expand file treeCollapse file tree

4 files changed

+15
-6
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+15
-6
lines changed

‎action.yml

Copy file name to clipboardExpand all lines: action.yml
+2-2Lines changed: 2 additions & 2 deletions
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

Copy file name to clipboardExpand all lines: dist/setup/index.js
+1-1Lines changed: 1 addition & 1 deletion
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

Copy file name to clipboardExpand all lines: docs/advanced-usage.md
+10-1Lines changed: 10 additions & 1 deletion
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

Copy file name to clipboardExpand all lines: src/install-python.ts
+2-2Lines changed: 2 additions & 2 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.