diff --git a/action.yml b/action.yml index a1dd5b77f..2855adef6 100644 --- a/action.yml +++ b/action.yml @@ -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." diff --git a/dist/setup/index.js b/dist/setup/index.js index 321877d9a..c699e65d0 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -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'; diff --git a/src/install-python.ts b/src/install-python.ts index 397da0cb9..44e9fa3b2 100644 --- a/src/install-python.ts +++ b/src/install-python.ts @@ -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';