Skip to content

Commit 0b992d8

Browse files
committed
Add support for adding a token on GHES to prevent rate limiting
1 parent 9a11568 commit 0b992d8

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ inputs:
1616
default: ${{ github.token }}
1717
cache-dependency-path:
1818
description: 'Used to specify the path to dependency files. Supports wildcards or a list of file names for caching multiple dependencies.'
19+
ghes_token:
20+
description: Used to pull python distributions from actions/python-versions when using Github Enterprise. This should be a github.com read only access token
21+
default: ""
1922
outputs:
2023
python-version:
2124
description: "The installed python version. Useful when given a version range as input."

dist/setup/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52264,7 +52264,12 @@ const tc = __importStar(__webpack_require__(533));
5226452264
const exec = __importStar(__webpack_require__(986));
5226552265
const utils_1 = __webpack_require__(163);
5226652266
const TOKEN = core.getInput('token');
52267-
const AUTH = !TOKEN || utils_1.isGhes() ? undefined : `token ${TOKEN}`;
52267+
const GHES_TOKEN = core.getInput('ghes_token');
52268+
const AUTH = utils_1.isGhes()
52269+
? `token ${GHES_TOKEN}`
52270+
: TOKEN
52271+
? `token ${TOKEN}`
52272+
: undefined;
5226852273
const MANIFEST_REPO_OWNER = 'actions';
5226952274
const MANIFEST_REPO_NAME = 'python-versions';
5227052275
const MANIFEST_REPO_BRANCH = 'main';

src/install-python.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ import {ExecOptions} from '@actions/exec/lib/interfaces';
66
import {IS_WINDOWS, IS_LINUX, isGhes} from './utils';
77

88
const TOKEN = core.getInput('token');
9-
const AUTH = !TOKEN || isGhes() ? undefined : `token ${TOKEN}`;
9+
const GHES_TOKEN = core.getInput('ghes_token');
10+
const AUTH = isGhes()
11+
? `token ${GHES_TOKEN}`
12+
: TOKEN
13+
? `token ${TOKEN}`
14+
: undefined;
1015
const MANIFEST_REPO_OWNER = 'actions';
1116
const MANIFEST_REPO_NAME = 'python-versions';
1217
const MANIFEST_REPO_BRANCH = 'main';

0 commit comments

Comments
 (0)