Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for adding a token on GHES to prevent rate limiting #316

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ inputs:
default: ${{ github.token }}
cache-dependency-path:
description: 'Used to specify the path to dependency files. Supports wildcards or a list of file names for caching multiple dependencies.'
ghes_token:
description: Used to pull python distributions from actions/python-versions when using Github Enterprise. This should be a github.com read only access token
default: ""
outputs:
python-version:
description: "The installed python version. Useful when given a version range as input."
Expand Down
9 changes: 8 additions & 1 deletion dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52264,7 +52264,14 @@ const tc = __importStar(__webpack_require__(533));
const exec = __importStar(__webpack_require__(986));
const utils_1 = __webpack_require__(163);
const TOKEN = core.getInput('token');
const AUTH = !TOKEN || utils_1.isGhes() ? undefined : `token ${TOKEN}`;
const GHES_TOKEN = core.getInput('ghes_token');
const AUTH = utils_1.isGhes()
? GHES_TOKEN
? `token ${GHES_TOKEN}`
: undefined
: TOKEN
? `token ${TOKEN}`
: undefined;
const MANIFEST_REPO_OWNER = 'actions';
const MANIFEST_REPO_NAME = 'python-versions';
const MANIFEST_REPO_BRANCH = 'main';
Expand Down
9 changes: 8 additions & 1 deletion src/install-python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ import {ExecOptions} from '@actions/exec/lib/interfaces';
import {IS_WINDOWS, IS_LINUX, isGhes} from './utils';

const TOKEN = core.getInput('token');
const AUTH = !TOKEN || isGhes() ? undefined : `token ${TOKEN}`;
const GHES_TOKEN = core.getInput('ghes_token');
const AUTH = isGhes()
? GHES_TOKEN
? `token ${GHES_TOKEN}`
: undefined
: TOKEN
? `token ${TOKEN}`
: undefined;
const MANIFEST_REPO_OWNER = 'actions';
const MANIFEST_REPO_NAME = 'python-versions';
const MANIFEST_REPO_BRANCH = 'main';
Expand Down